7个不是经常用但很强大的Linux命令

本文中文部分参考: 本文英文部分参考:

1. sudo !!命令

没有特定输入sudo命令而运行,将给出没有权限的错误。那么,你不需要重写整个命令,仅仅输入’!!’就可以抓取最后的命令。 sudo !! command Running the command without specifying sudo command will give you permission denied error. So, you don’t need to rewrite the whole command again just put ‘!!‘ will grab the last command.

$ apt-get updateE: Could file /var/lib/apt/lists/lock – open (13: Permission denied) E: Unable to lock directory /var/lib/apt/lists/E: Could file /var/lib/dpkg/lock – open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?$ sudo !!sudo apt-get update [sudo] password for server: …..Fetched 474 kB in 16s (28.0 kB/s) Reading package lists… Done server@localhost:~$

2. python命令

下面的命令生产一个通过HTTP显示文件夹结构树的简单网页,可以通过浏览器在端口8000访问,直到发出中断信号。

python command

The below command generates a simple web page over HTTP for the directory structure tree and can be accessed at port 8000 in browser till interrupt signal is sent.

python -m SimpleHTTPServer

3.ss命令

“ss”表示socket统计。这个命令调查socket,,显示类似netstat命令的信息。它可以比其他工具显示更多的TCP和状态信息。

ss Command

The “ss” stands for socket statistics. The command investigates the socket and shows information similar to netstat command. It can display more TCP and state informations than other tools.

4.last命令 “last”命令显示的是上次登录用户的历史信息。这个命令通过搜索文件“/var/log/wtmp”,显示logged-in和logged-out及其tty‘s的用户列表。 last Command

The “last” command show the history of last logged in users. This command searches through the file “/var/log/wtmp” and shows a list of logged-in and logged-out users along with tty’s.

5.pstree命令 这个命令显示当前运行的所有进程及其相关的子进程,输出的是类似‘tree’命令的树状格式。 pstree This commands shows all the processes running currently along with associated child process, in a tree like format similar to ‘tree‘ command output.

6. tree命令

以树式的格式得到当前文件夹的结构。

tree command

Get the current directory structure in tree like format.

7. nl命令

“nl命令”添加文件的行数。一个叫做’one.txt’的文件,其每行的内容是(Fedora、Debian、Arch、Slack和Suse),给每行添加行号。首先使用cat命令显示“one.txt”的文件内容。

nl Command

The “nl command” number the lines of a file. Number the lines of a file say ‘one.txt‘ with lines say (Fedora, Debian, Arch, Slack and Suse). First list the content of a file “text.txt” using cat command.

人若勇敢就是自己最好的朋友

7个不是经常用但很强大的Linux命令

相关文章:

你感兴趣的文章:

标签云: