基本的Unix命令

我是Linux的新手,我正在尝试创build一个备忘单来帮助我记住常见的bash命令。 如果您知道以下任务的任何命令,请将其发布。 我很感激!

命令:

  1. 您所在系统的主机名?
  2. 机器运行的操作系统的types和版本?
  3. 您的主目录的完整path?
  4. 哪些其他用户login到您正在使用的机器?
  5. 任何人从/ usr / bin执行的最后五个命令?
  6. 拼写检查字典(/ usr / dict / words)中有多less个单词?
  7. 你属于哪个组?
  8. 什么文件(不包括目录)在你的主目录及其所有子目录中?
  9. 什么手册页引用'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中使用它们。

  1. $主机名

  2. $ cat / etc / *发布

    注意:这在除了纯Debian之外的大多数发行版上都可以使用。 在debian上,'cat / etc / debian_version'

  3. $ echo〜

  4. $ w

  5. $ history | grep / usr / bin

    将只显示该用户的历史logging。 不确定整个系统的历史。 也许我可以在这里学到些东西。

  6. $ wc -l $(find / usr / share / dict -follow -type f -print)| grep total

    假设有多个单词文件并且没有重复的单词。 现在遵循符号链接!

  7. $组

  8. $ find〜-type f

  9. $ grep -R bash / usr / share / man

我也觉得我只是做了一些孩子的功课。 而这个网站的格式是一个噩梦。