"Linux" fun Linux commands (ii)

Source: Internet
Author: User
Tags curl ping and traceroute

About Linux Talk:http://man.linuxde.net/talk

The following article transfers from: Http://www.oschina.net/translate/11-lesser-known-useful-linux-commands

(For time reference only, if forbid reprint, contact is deleted)

The Linux command line attracts most Linux enthusiasts. A normal Linux user typically has about 50-60 commands to handle daily tasks. Linux commands and their transformations are the most valuable treasures for Linux users, Shell scripting programmers, and administrators. Some Linux commands are rarely known, but they are handy and useful, whether you're a novice or a premium user.

Few people know the Linux command

The purpose of this article is to introduce some of the less known Linux commands that will certainly help you manage your desktop/server efficiently.

Ley translated more than 4 years ago2 person TopTopWell translated! 1. sudo!! Command

Running without a specific input sudo command will give you an error with no permissions. Well, you don't need to rewrite the entire command, just type '!! ' You can grab the last command.

$ apt-getUpdatee:couldNotOpenLockFile/var/lib/apt/lists/lock-open ( Span class= "Hljs-number" >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?              
16s ([email protected]:~$
2. Python commands

The following command produces a simple Web page that displays the folder tree through HTTP, which can be accessed through the browser on port 8000 until the interrupt signal is signaled.

# python-m Simplehttpserver
Ley translated more than 4 years ago4 person TopTopWell translated! 3. MTR command

Most of us are familiar with Ping and traceroute. What about the MTR commands that combine the functions of two commands. If the MTR is not installed on your machine, apt or yum needs the package.

Install MTR (onDebian based Systems)
# yum Install MTR (onRed Hat based Systems)
Now run the MTR command to start looking at the network connection of the host and google.com that are running on the MTR.
# mtr google.com

MTR command

Ley translated more than 4 years ago2 person TopTopWell translated! 4. Ctrl+x+e command

This command is useful for administrators and developers. To automate daily tasks, administrators need to open the editor by entering VI, VIM, nano, and so on.

By simply tapping "ctrl-x-e" from the command line, you can start working in the editor.

5. NL command

The "NL command" adds the number of lines to the file. A file called ' One.txt ' with each line of content (Fedora, Debian, Arch, Slack, and SuSE), adding line numbers to each line. First, use the Cat command to display the file contents of "One.txt".

Fedora Debian Arch Slack SuSE
Now run the "NL command" to display it as a line number to add.
# NL One.txt 1 Fedora 2 Debian 3 arch 4 slack 5 SuSE
Ley translated more than 4 years ago2 person TopTopWell translated! 6. Shuf command

The "Shut" command randomly selects rows/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
# public  Desktop Downloads Videos
#  ls | shuf-n1 (pick on random selection) 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 any random selection using N3, N4 and other digital outputs. 7. SS Command

"SS" indicates socket statistics. This command investigates the socket and displays information similar to the netstat command. It can display more TCP and status information than other tools.

#SsStateRecv-qSend-qLocalAddress:P ORTPeerAddress:P ORTEstab 0 0 192.168.1.198: 41250 *.*.*.*: httpClose-wait 1 0 127.0.0.1: 8000 127.0.0.1: 41393Estab 0 0 192.168.1.198: 36239 *.*.*.*: httpEstab 310 0 127.0.0.1:8000 127 .0.0.1< Span class= "Hljs-selector-pseudo" >:41384 estab 0 0 192 .168.1:41002 *.*.*.*:http estab 0 0 127.0.0.1:41384 127.0 .0.1 : 8000                 
Ley translated more than 4 years ago2 person TopTopWell translated! 8. Last Command

The last command displays historical information about the user who was logged on. This command displays a list of users of Logged-in and Logged-out and their TTY ' s by searching for the file "/var/log/wtmp".

#LastServerpts/0: 0TueOct2212: 03StillLoggedInchServerTty8: 0TueOct2212: 02StillLoggedIn ... (UnknownTty8:0 Tue Oct2212:02-12:02 (00:XX) Server pts/0:0 Tue Oct2210:33-12:02 (01:) ServerTty7:0 Tue Oct2210:05-12:02 (01:(Unknowntty7: 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 Span class= "Hljs-number" >2007            
9. Curl Ifconfig.me

So how do you get your external IP address? Use Google? Then this command will output your external IP address at your terminal.

# Curl Ifconfig.me
Note: You may not follow the curl package and you need to Apt/yum to follow the package.

Ten. Tree command

Gets the structure of the current folder in a tree-style 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 |< Span class= "hljs-comment" >--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          
Ley translated more than 4 years ago2 person TopTopWell translated! Pstree.

This command displays all currently running processes and their associated sub-processes, and outputs a tree-like format similar to the ' Tree ' command.

#Pstreeinit─┬─networkmanager───{networkmanager}├─accounts-daemon───{accounts-daemon}├─acpi_fakekeyd├─acpid├─apache2───10*[apache2]├─at-spi-bus-laun───*[{at-spi-bus-laun}]├─atd├─avahi-daemon───avahi-daemon├─bluetoothd├─colord───{colord}├─colord-sane───*[{colord-sane}]├─console-kit-dae───64*[{console-kit-dae}]├─cron├─cupsd├─*[dbus-daemon]├─dbus-launch├─dconf-service───*[{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*[{x-sessi+│││└─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───{< Span class= "Hljs-selector-tag" >gsd-printer}├─gvfs-afc-volume───{gvfs-afc-volume } 
So far so much. In the next article, I'll cover some other interesting linux commands that few people know about. Then connect the tecmint to stay tuned. Liking and sharing will help us spread.

"Linux" fun Linux commands (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.