In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about what few people know about Linux commands. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Sudo!! Command
Running without a specific input sudo command will give an error with no permissions. So, you don't need to rewrite the entire command, just type'! 'you can capture the command of *.
$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 command
The following command produces a simple web page that displays the folder structure tree through HTTP, which can be accessed by the browser on port 8000 until an interrupt signal is sent.
# python-m SimpleHTTPServer
3. Mtr command
Most of us are familiar with ping and traceroute. What about the mtr command that combines the functions of the two commands into one? If mtr is not installed on your machine, apt or yum needs the package.
$sudo apt-get install mtr (On Debian based Systems) # yum install mtr (On Red Hat based Systems)
Now run the mtr command to start looking at the direct network connection between the host on which mtr is running and google.com.
# mtr google.com
4. Ctrl+x+e command
This command is very useful for administrators and developers. To automate daily tasks, the administrator needs to open the editor by typing vi, vim, nano, and so on.
Just tap "Ctrl-x-e" quickly from the command line to get started in the editor.
5. Nl command
The number of lines that the nl command adds to the file. A file called 'one.txt', with the contents of each line (Fedora, Debian, Arch, Slack, and Suse), adds a line number to each line. First use the cat command to display the file contents of "one.txt".
# cat one.txt fedora debian arch slack suse
Now run the nl command to display it by adding a line number.
# nl one.txt 1 fedora 2 debian 3 arch 4 slack 5 suse
6. Shuf command
The "Shut" command randomly selects lines / files / folders from a file or folder. First use the ls command to display the contents of the folder.
# ls Desktop Documents Downloads Music Pictures Public Templates Videos # ls | shuf (shuffle Input) Music Documents Templates Pictures Public Desktop Downloads Videos # ls | shuf-N1 # randomly select a Public # ls | shuf-N1 Videos # ls | shuf-N1 Templates # ls | shuf-N1 Downloads
Note: you can replace'N1 'with' N2'to output two random selections or use numbers such as n3 and N4 to output any other random selections.
7. Ss command
"ss" means socket statistics. This command investigates socket and displays information similar to the netstat command. It can display more TCP and status information than other tools.
# ss State Recv-Q Send-Q Local Address:Port Peer Address:Port ESTAB 00 192.168.1.198 ESTAB 41250 *. *: http CLOSE-WAIT 1 0 127.0.1 ESTAB 00 192.168.1 198RV 36239 *. *: http ESTAB 3100 0 127.0.0.1 http ESTAB 8000 127.0.1 ESTAB 00 192.168.1.19841002 *. *: http ESTAB 00 127.0.1
8. Last command
The "last" command displays the historical information of the last logged-in user. This command displays a list of users for logged-in and logged-out and their tty's by searching for the file "/ var/log/wtmp".
# last server pts/0: 0 Tue Oct 22 12:03 still logged in server tty8: 0 Tue Oct 22 12:02 still logged in... ... (unknown tty8: 0 Tue Oct 22 12:02-12:02 (00:00) server pts/0: 0 Tue Oct 22 10:33-12:02 (01:29) server tty7: 0 Tue Oct 22 10:05-12 server pts/0 02 (01 Tue Oct 56) (unknown tty7: 0 Tue Oct 22 10:04-10:05 (00:00) reboot system boot 3.2.0-4-686-pae Tue Oct 22 10:04-12:44 (02:39) wtmp begins Fri Oct 4 14:43:17 2007
9. Curl ifconfig.me
So how do I get your external IP address? Use google? Then this command outputs your external IP address on your terminal.
# curl ifconfig.me
Note: you may not follow the curl package, you need apt/yum to follow the package.
10. Tree command
Gets the structure of the current folder in tree format.
# tree. | |-- Desktop |-- Documents | `--37.odt |-- Downloads |-- attachments.zip | |-- ttf-indic-fonts_0.5.11_all.deb | |-- ttf-indic-fonts_1.1_all.deb |`-- wheezy-nv-install.sh |-- Music |-- Pictures | |-- Screenshot from 2013-10-22 12:03:49.png | `--Screenshot from 2013-10-22 12:12 | : 38.png |-- Public |-- Templates `--Videos 10 directories 23 files
11. Pstree
This command displays all currently running processes and their associated children, and outputs a tree format similar to the 'tree' command.
# pstreeinit ─┬─ NetworkManager ─── {NetworkManager} ├─ accounts-daemon ─── {accounts-daemon} ├─ acpi_fakekeyd ├─ acpid ├─ apache2 ─── 10 * [apache2] ├─ at-spi-bus-laun ─── 2 * [{at-spi-bus-laun}] ├─ atd ├─ avahi-daemon ─── avahi-daemon ├─ bluetoothd ├─ colord ─── Colord} ├─ colord-sane ─── 2 * [{colord-sane}] ├─ console-kit-dae ─── 64 * [{console-kit-dae}] ├─ cron ├─ cupsd ├─ 2 * [dbus-daemon] ├─ dbus-launch ├─ dconf-service ─── 2 * [{dconf-service}] ├─ dovecot ─┬─ anvil │ ├─ config │ └─ log ├─ exim4 ├─ gconfd-2 ├─ gdm3 ─┬─ gdm-simple-slav Xorg │ │ ├─ gdm-session-wor ─┬─ x-session-manag ─┬─ evolution-a+ │ ├ ─ gdu-notific+ │ ├─ gnome-scree+ │ ├─ gnome-setti+ │ ├─ gnome-shell+++ │ ├─ nm-applet ── + │ ├─ ssh-agent │ │ ├─ tracker-min+ │ ├─ tracker-sto+ │ └─ 3 * [{Xmuresi + │ │ │ └─ 2 * [{gdm-session-wor}] │ │ └─ {gdm-simple-slav} │ └─ {gdm3} ├─ 6 * [getty] ├─ gnome-keyring-d ─── 9 * [{gnome-keyring-d}] ├─ gnome-shell-cal ─── 2 * [{gnome-shell- Cal}] ├─ goa-daemon ─── {goa-daemon} ├─ gsd-printer ─── {gsd-printer} ├─ gvfs-afc-volume ─── {gvfs-afc-volume} Thank you for reading! This is the end of this article on "what are the Linux commands that few people know?" I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.