我有一个这样的用户:
uid=501(ironsand) gid=500(foo) groups=500(foo),10(wheel),497(git),501(ironsand)
Run Code Online (Sandbox Code Playgroud)
并将主要组更改为 Ironsand like gid=501(ironsand),我输入了以下命令:
sudo usermod -g ironsand ironsand
Run Code Online (Sandbox Code Playgroud)
它改变了组的顺序,但没有改变主组,如:
uid=501(ironsand) gid=500(foo) groups=501(ironsand),10(wheel),497(git),500(foo)
Run Code Online (Sandbox Code Playgroud)
我以为有人已经问过这样的问题,但我找不到。
如何更改主要组?
如果我想知道 的含义wget -b,我看手册man wget,然后搜索-b选项。
-b
--background
Go to background immediately after startup. If no output file is specified via the -o, output is redirected to wget-log.
Run Code Online (Sandbox Code Playgroud)
我想通过像man wget -b. (当然这行不通。)
有没有类似的方法使它成为可能?
如何从命令行检查 utf-8 文本文件是否具有 BOM?
file命令显示我UTF-8 Unicode text。
但我不知道这意味着文件中没有 BOM。
我正在使用Ubuntu 12.04.
我同步~/.gitconfig,并~/.gitignore通过使用Dropbox和符号链接创建为它在Ubuntu和Mac文件。
并且excludesfile是这样声明的。
[core]
editor = /usr/bin/vim
excludesfile = /Users/username/.gitignore
Run Code Online (Sandbox Code Playgroud)
问题是主目录因操作系统而异,因此我需要对 excludesfile 进行多个设置。
可以定义多个core.excludesfile吗?
我想通过Ctrl+ Win zshlike删除一个单词。
vim /foo/bar^W
vim /foo/
Run Code Online (Sandbox Code Playgroud)
并为 找到了解决方案bash,但bind不在 zsh 函数中。
如何将Ctrl+配置W为 a delete-word?
我想在使用 Mac 时使用emacsfromApplications文件夹,但我.zshrc在 Ubuntu 中使用相同的文件夹。
alias emacs='/Applications/Emacs.app/Contents/MacOS/bin/emacsclient'
Run Code Online (Sandbox Code Playgroud)
所以我只想在我使用OS X. 如何获得操作系统名称.zshrc?
有没有办法替换符号链接的值?
例如,我想像这样替换符号链接:
first -> /home/username/foo/very/long/directories/that/I/do/not/want/to/type/again
Run Code Online (Sandbox Code Playgroud)
到
second -> /home/username/bar/very/long/directories/that/I/do/not/want/to/type/again
Run Code Online (Sandbox Code Playgroud)
我只想更改foo为bar.
当然我可以再次创建链接,但是如果可以替换链接的值,它会变得更容易。
我现在使用带有-e 'ssh -p 10022'选项的rsync来指定端口。
我已经在~/.ssh/config.
Host myvps
HostName example.com
User ironsand
Port 10022
Run Code Online (Sandbox Code Playgroud)
我可以轻松地从 rsync 使用这个配置吗?或者我可以~/.rsync为指定的服务器创建和设置默认端口吗?
我在一个目录中有数百个 pdf 文件和 html 文件。我想知道pdf文件的总大小。
通过命令,du -ch /var/foo我可以看到总文件大小,但我只需要最后一行,即总大小。
如果目录只包含pdf文件我可以使用-s选项,但这次不能使用该选项。
如何仅获取特定文件类型的总大小?
我有这些功能~/.bashrc:
function guard() {
if [ -e 'Gemfile' ]; then
bundle exec guard "$@"
else
command guard "$@"
fi
}
function rspec() {
if [ -e 'Gemfile' ]; then
bundle exec rspec "$@"
else
command rspec "$@"
fi
}
function rake() {
if [ -e 'Gemfile' ]; then
bundle exec rake "$@"
else
command rake "$@"
fi
}
Run Code Online (Sandbox Code Playgroud)
如您所见,这些功能非常相似。我想一次定义这 3 个函数。有没有办法做到?
环境
bash --version
GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)
Run Code Online (Sandbox Code Playgroud)