Linux Support


USEFUL COMMONDS FOR LINUX ADMINISTRATION

uptime
This command displays a one line summary showing...
       Example:- [root@akwal]# uptime
 09:51:14 up  2:09,  3 users,  load average: 0.38, 0.22, 0.16
last reboot
The top row show you last reboot or uptime
who
This command will display...

  • All users logged in
  • tty device(line) they are using
  • When they logged in
  • Idle time
  • Where they logged in from
  • Example:- [root@akwal]# who
id
This command displays a one line summary for the current user listing...
user name and number
primary group and number
other groups and numbers
Example:- [root@akwal]# id
uid=1000(roger) gid=100(users) groups=100(users),16(dialout),40(game)
Example:- [root@akwal]# id
free
This command displays statistics on memory usage. The values represent KB's.
Example:- [root@akwal]# free
total used free shared buffers cached
Mem: 63208 61484 1724 27848 1060 49360
-/+ buffers/cache: 11064 52144
Swap: 128516 6500 122016
du
This command stands for disk usage and will print the size of the current directory and subdirectories in 1 KB sizes.
Example:- [root@akwal]# du
df
This command displays information for each file system.
Example:- [root@akwal]# df
env
This command lists all shell (environment) variables and their contents for the current user.
Example:- [root@akwal]# env
ps
This command lists process status. There are many options for this command. Below are the two most common.
Example:- [root@akwal]# ps
top
This command display a full screen of information of the top processes. It will update automatically until the program is stopped. To stop the display, enter q.

The system, check first the history than the last log-ins, system uptime, last reboot,
history; last ; uptime ; last reboot;

Example:- [root@akwal]# history
                [root@akwal]# last
Checking Linux General system info:-
# uname -a;id;uptime;date;free -mtol;who;cat /proc/cpuinfo;echo $PATH;df -m; sysctl vm;
Checking Linux General network configuration info:-
# ip addr show ; ip route show ; ip neigh show; ip rule list; head /etc/resolv.conf
This will show the ip address of the interfaces, the routes, the arp cache , list the routing table rules and our DNS’s.
Monitor the RAM usage of all processes :-
ps -eo pid,ppid,rss,vsize,pcpu,pmem,cmd -ww --sort=pid
Other Specific health checks:-
df -i; cat /proc/mdstats;
df -i checking Inodes state, and /proc/mdstats if we have RAID on the box.
Check for big files and where are the most files on the system:-
for i in *; do echo -n "$i: "; find $i -type f | wc -l; done
--  (count files under directories)
find . -type f -size +30000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
--  (check for files more then 30000kb)
Check  the logs if there are any warnings or fatal errors, and other important logs:-
zcat messages-* | grep -i warning | less
zcat messages-* | grep -i fatal | less
dmesg | less
Check full system configuration:-
sysctl -a