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 update

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) 
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock 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命令<喎?http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vc3Ryb25nPjxiciAvPg0KJmxkcXVvO2xhc3QmcmRxdW87w/zB7s/Uyr61xMrHyc+0zrXHwrzTw7untcTA+sq30MXPoqGj1eK49sP8we7NqLn9y9HL987EvP4mbGRxdW87L3Zhci9sb2cvd3RtcCZyZHF1bzujrM/Uyr5sb2dnZWQtaW66zWxvZ2dlZC1vdXS8sMbkdHR5JmxzcXVvO3O1xNPDu6fB0LHtoaM8YnIgLz4NCjxzdHJvbmc+bGFzdCBDb21tYW5kPC9zdHJvbmc+PC9jb2RlPjwvY29kZT48L2NvZGU+PC9wPg0KPHA+PGNvZGUgY2xhc3M9"hljs sql">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.
这里写图片描述

 

相关内容