Frequently used Advanced linux Commands


1.) lsof

userName@hostName:~# lsof

lsof means “list open files”, it displays all the files that are currently opened. It shows which processes uses a certain file

2.) logsave
logsave captures output of a program and sends it to a log-file

userName@hostName:~# logsave -a test.log echo "hello world"

3.) watch
Watch executes a program periodically and outputs the contents on the screen.

userName@hostName:~# watch 'ls ; echo ;  pwd'

4.) ssh
To login to remote host

userName@hostName:~# ssh remoteUser@remoteHost 

Ex :-

userName@hostName:~# ssh [email protected] 

5.) service
Service command is used to run the linux machine init scripts.
To Check the status of all the services.

userName@hostName:~# service –status-all

6.) whereis
When we want to find out where a specific Unix command exists, eg

userName@hostName:~# whereis java

Similarly whatis to display single line description about a command, eg :- whatis ls

7.) To set the date, date -s "11/5/2017 23:59:53"
Once we’ve changed the system date, we should syncronize the hardware clock with the system date as shown below.

userName@hostName:~#  hwclock --systohc –utc

8.) wget

wget method is used to download software, video from internet.

userName@hostName:~# wget http://prdownloads.sourceforge.net/sourceforge/softwareName/softwareVersion 

9.) awk
The Awk searches files to see if they contain lines that matches given specified patterns and then perform associated actions. Below command finds lines with first column value greater than 100

userName@hostName:~# awk '$1 >100' students.txt

10.) ftp
To connect to a FTP server using ftp command

userName@hostName:~# ftp IP/HostName

Use the get command to download file from a remote ftp server

ftp> get fileName

11.) ifup
Ifup configures a network interface/enables a network connection.

ifdown
Ifdown shuts down a network interface/disables a network connection.

12.) sdiff
Sdiff finds differences between two files by producing list indicating lines that are dissimilar

13.) tcpdump
tcpdump allows us to analyze network activity

userName@hostName:~# tcpdump

14.) wireshark
wireshark is graphical tool to analyze network packets

15.) ncat
ncat is modern replacement to telnet
below command is used to establish a connection on port 80 to a host named remotehost
userName@hostName:~# ncat remotehost 8080

16.) yum or rpm
Similar to apt-get for managing, installing software packages in linux

17.) netstat
netstat provides the complete information on how the network interface is performing.

userName@hostName:~# netstat

18.) /etc/hosts
Translating the host name to IP addresses is known as name resolution. The host has a special file called hosts, which stores the IP Address – Hostname pairs.
In /ect/hosts file we can assign name to any IP address in our network.

userName@hostName:~# cat /etc/hosts

19.) w
The command w is a combination of uptime and who

userName@hostName:~# w

20.) Mpstat
mpstat reports processors statistics, below command displays all the individual CPUs (or Cores) along with its statistics.

userName@hostName:~# mpstat -p ALL

21.) Strace
Strace displays the system calls used by the process, and the signals received by the process.

userName@hostName:~# strace ls -lf

22.) GkrellM
GKrellM stands for GNU Krell Monitors, or GTK Krell Meters. It is GTK+ toolkit based monitoring program, that monitors various sytem resources.

23.) nslookup
A network utility program used to obtain information about Internet servers.

24.) dig
dig is a tool for querying DNS nameservers for information about host addresses