我是Linux的新手,我正在尝试创build一个备忘单来帮助我记住常见的bash命令。 如果您知道以下任务的任何命令,请将其发布。 我很感激!
命令:
1. hostname 2. lsb_release -a 3. echo ~ 4. who 5. history | grep /usr/bin | tail -n 5 6. wc -w /usr/dict/words 7. groups [id -G -n for extra marks] 8. find ~ -name \* -type f -print 9. man -k bash
确保你给你的工作适当的引用;)
1: hostname 2: uname -a 3: 4: users 5: cat ~/.bash_history (last commands in current user) to do exactly what you ask for you have to use grep over /etv/passwd to get the list of users and the use it to cat everyones .bash_history file 6: 7: cat /etc/passwd ans some grep wizardy 8: 9:
其他人已经回答你的具体查询。 如果你对学习shell感兴趣,你可能会比阅读LinuxCommand.org更糟糕。 如果您发现自己希望更进一步, 高级Bash脚本指南是一个很好的资源。
什么文件(不包括目录)在你的主目录及其所有子目录中?
$ cd $HOME $ find -name \* -type f -print
顺便说一句。 大多数这些命令不是bash内置的,而是独立的程序。 所以你可以从任何shell中使用它们。
$主机名
$ cat / etc / *发布
注意:这在除了纯Debian之外的大多数发行版上都可以使用。 在debian上,'cat / etc / debian_version'
$ echo〜
$ w
$ history | grep / usr / bin
将只显示该用户的历史logging。 不确定整个系统的历史。 也许我可以在这里学到些东西。
$ wc -l $(find / usr / share / dict -follow -type f -print)| grep total
假设有多个单词文件并且没有重复的单词。 现在遵循符号链接!
$组
$ find〜-type f
$ grep -R bash / usr / share / man
我也觉得我只是做了一些孩子的功课。 而这个网站的格式是一个噩梦。