find . -type f -print -exec cat {} \; | grep some string
上面的命令不打印文件路径。
我正在使用:Ubuntu, bash 4。
我用以下命令建立了一个符号链接:
ln -s ../test5
Run Code Online (Sandbox Code Playgroud)
我现在想删除它,但我的 rm 失败了:
$ rm -Rf test5/
rm: cannot remove `test5/': Not a directory
$ rm test5/
rm: cannot remove directory `test5/': Is a directory
$ rmdir test5/
rmdir: test5/: Not a directory
$rm -r test5/
rm: cannot remove `test5/': Not a directory
$ls -l
0 lrwxrwxrwx 1 peter peter 8 Jul 20 15:30 test5 -> ../test5/
Run Code Online (Sandbox Code Playgroud)
如何删除我的符号链接?(Ubuntu 8.10,bash)
当我使用 SSH 登录时,我只能看到这个...
-bash: /usr/bin/id: cannot execute binary file
-bash: [: : integer expression expected
Run Code Online (Sandbox Code Playgroud)
我在这里什么也做不了。命令如halt,poweroff,reboot将返回command not found。
我怎样才能解决这个问题?我正在使用 Debian Squeeze Linux
昨天我的终端开始围绕使用方括号运行的命令。我不确定我是如何打开它的,但想关闭它。
到目前为止,我已经完成了:
.bash_profile我也无法在谷歌上发现任何东西。
有任何想法吗?
更新
.bashrc我的主目录中有一个单行文件:
alias countlines='find . -type f -print0 | xargs -0 cat | wc -l'
Run Code Online (Sandbox Code Playgroud)
但它没有创建别名。为什么会这样?
我有一个 Ubuntu Server VPS,我想/bin/bash/用作我的 shell。我怎样才能改变我的外壳?我有 root 访问权限,但我不以 root 身份工作。所以破折号现在是我的默认外壳。
我已阅读如何将 Bash 设为 Ubuntu 上的默认 shell?和chsh接缝是首选的方式。但是当我输入时,chsh /bin/bash我收到此消息:
chsh: unknown user /bin/bash
如果我只是输入/bin/bashBash shell 接缝就可以正常工作。如何改变它?
每当我尝试bash使用适用于 Linux 的 Windows 子系统登录时,我都会尝试cd进入C:\Users\,但我得到的只是找不到目录。
CWindows Linux 子系统的驱动器在哪里?是孤立的吗?
bash shell command-line windows-subsystem-for-linux windows-10-v1607
这是我经常做的事情
$ mkdir foo
$ cd foo
Run Code Online (Sandbox Code Playgroud)
这作为单个命令工作,但它需要更多的击键并且不节省时间。
$ mkdir foo && cd foo
Run Code Online (Sandbox Code Playgroud)
这有捷径吗?
使用下面的帮助,这似乎是最优雅的答案。
# ~/.bashrc
function mkcd {
if [ ! -n "$1" ]; then
echo "Enter a directory name"
elif [ -d $1 ]; then
echo "\`$1' already exists"
else
mkdir $1 && cd $1
fi
}
Run Code Online (Sandbox Code Playgroud)