我有一个可执行的二进制文件;让我们称之为a.out。我可以看到二进制文件包含字符串
$ strings a.out
...
/usr/share/foo
....
Run Code Online (Sandbox Code Playgroud)
我需要将字符串更改/usr/share/foo为/usr/share/bar. 我可以用sed?替换字符串吗?:
sed -i 's@/usr/share/foo@/usr/share/bar@' a.out
Run Code Online (Sandbox Code Playgroud)
这看起来是一件安全的事情。当字符串长度不同时,这也能工作吗?
在 中撰写消息时mutt,我看到以下标题:
From:
To:
Cc:
Bcc:
Subject:
Reply-To:
Fcc: ~/.mail/sent
Mix: <no chain defined>
Security: None
Run Code Online (Sandbox Code Playgroud)
我不知道Mix:标题是做什么用的,而且我认为我永远不需要它。同样,我不需要编辑Reply-To:标题。
这两条无用的线路占用了宝贵的空间。是否可以完全删除这些标题?我可以指定在撰写菜单中显示哪些标题吗?
我知道,我可以ls像这样指定自定义时间格式
ls -lAF --time-style="+ %Y-%b-%d %H:%M:%S" --color=always
Run Code Online (Sandbox Code Playgroud)
但我想在时间格式中“走私”颜色。例如,我希望年份2014为红色。我该怎么做?
我曾尝试将颜色代码\033[0;31m放在 前面%Y,但代码不会被解释为颜色,而是被解释为胡言乱语。
ls选项--group-directories-first导致目录列在顶部,这使得输出ls漂亮和干净:
ls -l --group-directories-first
Run Code Online (Sandbox Code Playgroud)
但是,它不会作用于symlinks实际上symlinks是目录的 。有可能使用
ls -l -L --group-directories-first
Run Code Online (Sandbox Code Playgroud)
它将在顶部列出这两种目录,但不会区分正确的目录和符号链接的目录,这再次令人困惑。
可以ls在顶部显示符号链接目录,同时仍然使它们与常规目录不同吗?
编辑:
我正在使用bash.
我正在编写一个简单的脚本来 grep 我的 bash 历史记录以查找特定的字符串。在命令行上,我可以执行以下操作,效果很好:
history | grep git
Run Code Online (Sandbox Code Playgroud)
但是,当我使用与上面相同的命令创建 bash 脚本时,突然history什么都不返回:
#!/bin/bash
history | grep git
Run Code Online (Sandbox Code Playgroud)
当我删除第一行时#!/bin/bash,我的脚本再次运行。这里发生了什么?如何history在 bash 脚本中使用?
我为mutt. 当我开始时mutt,光标(即指示器)在第一条消息上(即,顶部的第一条消息被选中)。我为选定的消息定义了颜色,我也为新消息定义了颜色:
...
color indicator color233 color67
color index color75 color232 ~N
....
Run Code Online (Sandbox Code Playgroud)
不幸的是,无论消息是否是新消息,所选消息看起来都一样。有没有办法为选定的新邮件设置不同的颜色,以便我可以立即识别出选定的邮件是新邮件?否则我必须向下移动光标,才能看到消息是新的。
我已经尝试了明显的解决方案:
color indicator color233 color67 ~N
Run Code Online (Sandbox Code Playgroud)
但这不起作用。穆特抱怨:
Error in .muttrc, line 15: too many arguments
Run Code Online (Sandbox Code Playgroud) ./file为什么有些相对文件路径以, 而不是仅仅以 的形式显示file?例如,当我这样做时:
find .
Run Code Online (Sandbox Code Playgroud)
我得到这个输出:
./file1
./file2
./file3
Run Code Online (Sandbox Code Playgroud)
除了让道路更加混乱之外,实际目的是什么?这并不是说它可以阻止我发生一些事故。两者都是相对路径,并且cat ./file1工作方式与 相同cat file1。
这种行为是来自find命令,还是某个系统范围的 C 库?
好的,我明白为什么使用./filefor-exec构造是必要的(以确保我有... | xargs rm ./-i, 而不是... | xargs rm -i)。
但是在什么情况下./使用-print语句时缺少会破坏任何东西呢?
我正在尝试构建任何破坏某些内容的语句:
touch -- -b -d -f -i
find -printf '%P\n' | sort
-b
-d
-f
-i
Run Code Online (Sandbox Code Playgroud)
一切正常。
出于好奇,我如何构建一个-print声明来证明这个问题?
我知道如何从命令行(脚本)发送电子邮件
echo "body" | mail -s "subject" my@email.com
Run Code Online (Sandbox Code Playgroud)
是否也可以从命令行(脚本)发送附件?
我heirloom-mailx在 Debian Wheezy 上使用。
我可以find用来查找所有设置了扩展属性的文件吗?比方说,我想+i在/foo其子文件夹中找到所有具有, immutable 属性的文件。
我在man find.
有没有其他方法可以找到所有具有属性的文件
我正在使用 Debian Wheezy
要注销 LXDE,我可以单击“开始”菜单,单击“注销”,然后在弹出菜单时再次单击“注销”。
或者我可以输入lxde-logout我的终端,当菜单打开时,点击“注销”。
这两种选择都太麻烦了。我需要一个可以立即注销的命令,没有菜单,也没有其他选项。
这可能吗 ?
我在 Debian Wheezy 上使用 LXDE