Common Linux commands

Saturday, June 7, 2014

Common Linux commands

"uptime" is used to find how long the server has been online.

"top" command is used to find the list of all running processes on the server, It also shows the CPU load and CPU usage on the server.

*** To find the top 10 CPU processes use  "ps -eo pcpu,pid,user,args | sort -k1 -r | head -10"

OS Details
To find the LINUX OS version running in the machine issue "cat /etc/*-release"

"history" command is used to find the history of commands issues on this server by the user.

CPU Core
To find the no of CPU cores issue the command "grep pro /proc/cpuinfo -c"

Find Free Space
1. To find the total free space issue "df -k"
2. To find the free space in specific directory issue "df -k /some/dir"


Fdisk is a utility for managing partitions, but it is also for useful for displaying information about storage devices, Issuing command "sudo fdisk -l" will give the details about all storage devices connected to the system.

On Linux, UNIX file systems on different partitions and removable devices like CDs, DVDs, or USB flash drives can be attached to a certain point (that is, the mount point) in the directory tree, and detached again. To attach or detach a file system, you can use the mount or umount command respectively.

To display all currently attached file systems, run the "mount" command.

*** Normally i use this command to check if our mounts in rw(read write) mode.

The grep command allows you to search one file or multiple files for lines that contain a pattern

grep "string_to_be_searched" filename

ps gives a snapshot of the current processes, using ps with grep you can search for the process id using the process name.

ps -ef|grep "process_name"

*** khu and phantom example process names

*** To find the number of phantom running Issue "ps -ef|grep phantom|wc -l"
*** To find the list of top Phantom running Issue "ps -ef|grep phantom|head -20"
*** To find the list of all ISD jobs running issue "ps -ef|grep 'phantom DSD.RUN ISD'"

Kill command is used to kill the running process.

"kill -9 process_id"

*** process_id is something you already found using ps -ef|grep command.

Instead of finding the process ID and issuing a kill command you can use "pkill" which finds and kills all processes based on the given process name.

"pkill -9 -f process_name"

"pkill -9 -f ISDgetGF"

*** This will kill all jobs which starts with the name "ISDgetGF"

How to find DB2 client version in Linux

db2ls -p -q -b "DB2 Directory Name"

db2ls -p -q -b /opt/ibm/db2/V10.5

Error 404

The page you were looking for, could not be found. You may have typed the address incorrectly or you may have used an outdated link.

Go to Homepage