11 Lesser Known Useful Linux Commands

Linux command line attracts most of the Linux Enthusiastic. A normal Linux user usually posses a vocabulary of roughly 50-60 instructions to perform their everyday project. Linux instructions and their switches stays the maximum precious treasure for a Linux-consumer, Shell-script programmer and Administrator. There are a few Linux Commands that are lesser Known, but very useful and reachable no matter the reality whether or not you’re a Novice or an Advanced User.

11 Lesser Known Useful Linux Commands This very article ambitions at throwing mild on some of the lesser regarded Linux commands which in reality will assist you to handle your Desktop/Server extra successfully.

1. sudo !! command

Running the command without specifying sudo command will give you permission denied error. So, you don’t need to rewrite the complete command again just placed ‘!!‘ will seize the final 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 command

The under command generates a easy web page over HTTP for the directory shape tree and may be accessed at port 8000 in browser till interrupt signal is despatched.

# python -m SimpleHTTPServer

3. mtr Command

Most folks are acquainted with ping and traceroute. How about combining the capability of each the command into one with mtr command. In case mtr is not established into your gadget, apt or yum the required bundle.

$ sudo apt-get install mtr (On Debian based Systems)
# yum install mtr (On Red Hat based Systems)

Now run mtr command to begin investigating the community connection among the host mtr runs on and google.Com.

# mtr google.com

4. Ctrl+x+e Command

11 Lesser Known Useful Linux Commands this is very a lot useful for administrator and builders. To Automate daily task an administrator wishes to open editor by means of typing vi, vim, nano, and many others. How approximately firing instant editor (from terminal).

Just Press “Ctrl-x-e” from the terminal spark off and start working in editor.

5. nl Command

11 Lesser Known Useful Linux Commands for The “nl command” number the traces of a record. Number the traces of a document say ‘one.Txt‘ with traces say (Fedora, Debian, Arch, Slack and Suse). First listing the content material of a record “one.Txt” the use of cat command.

# cat one.txt 

fedora 
debian 
arch 
slack 
suse

Now run “nl command” to list them in a numbered fashion.

# nl one.txt 

1 fedora 
2 debian 
3 arch 
4 slack 
5 suse

6. shuf Command

The “shuf” command randomly pick out lines/documents/folder from a record/folder. First list the contents of a folder using ls command.

# ls 

Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
#  ls | shuf (shuffle Input)

Music 
Documents 
Templates 
Pictures 
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 always replace ‘n1‘ with ‘n2‘ to pick random choice or every other variety of random selection the usage of n3, n4.…

7. ss Command

The “ss” stands for socket information. The command investigates the socket and suggests statistics just like netstat command. It can show greater TCP and state informations than other tools.

# ss 

State      Recv-Q Send-Q      Local Address:Port          Peer Address:Port   
ESTAB      0      0           192.168.1.198:41250        *.*.*.*:http    
CLOSE-WAIT 1      0               127.0.0.1:8000             127.0.0.1:41393   
ESTAB      0      0           192.168.1.198:36239        *.*.*.*:http    
ESTAB      310    0               127.0.0.1:8000             127.0.0.1:41384   
ESTAB      0      0           192.168.1.198:41002       *.*.*.*:http    
ESTAB      0      0               127.0.0.1:41384            127.0.0.1:8000

8. last Command

The “remaining” command display the records of remaining logged in users. This command searches through the report “/var/log/wtmp” and indicates a list of logged-in and logged-out customers together with tty’s.

#  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:02  (01: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

The “remaining” command display the records of remaining logged in users. This command searches through the report “/var/log/wtmp” and indicates a list of logged-in and logged-out customers together with tty’s.

# curl ifconfig.me

Note: You may don’t have curl package hooked up, you need to apt/yum to install bundle.

10. tree command

Get the cutting-edge listing structure in tree like 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 instructions shows all the approaches going for walks presently in conjunction with associated infant method, in a tree like format much like ‘tree‘ command output.

# pstree 
init─┬─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*[{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───{gsd-printer} 
     ├─gvfs-afc-volume───{gvfs-afc-volume}

That’s considering now. In the subsequent article of mine I might cover positive different lesser regarded Linux commands which might be a laugh. Till then live tuned and connected to Tecmint. Like and proportion us and help us get spread.