Wednesday, September 14, 2011

Some usefull commands for Linux

Open your terminal window,

1. Read linux system IP address in a shell script:
# ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'

2.  Some process activity commands:
# top                                                                                                                    
The top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds.

3. Find out who is logged on and what they are doing
# w                                                                                                                       
The command displays information about the users currently on the machine, and their processes.

4. How long the system has been running
# uptime                                                                                                              

5. The current running process information
# ps                                                                                                                     
  And also try
  # ps -A                                                                                                              
     The above one is shows all currently running process.

6. Memory usages
# free                                                                                                                  
It will shows the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.

7. check the hard disk usages
# df -h                                                                                                                  
 This will output the usage of each partition in the server.

8. The specific directory memory usages size list
# du -sh /home/                                                                                                       

9.  If you want to list all the subdirectory sizes under /home, run the following command:
# du -sh /home/*                                                                                                      

10. Check the system partition information
# fdisk -l                                                                                                            

11. Check the root user cronjobs information
#crontab -l                                                                                                       









12. Remote file download
scp user@remote_host:remote_file local_file
ex: scp -P 23 vvelu@65.00.0.0:/home/velu/temp/test.txt test.txt

13. Upload file to Remote
scp local_file user@remote_host:remote_file
ex: scp -P 23 ./test.txt vvelu@60.0.0.0:/home/vvelu/tmp/test.txt

Ubuntu useful commands 

12. Remove partial packages from the system
sudo apt-get autoclean                                                                                         

13.To clean remove .deb packages that apt caches when you install/update programs
sudo apt-get clean                                                                                              

No comments:

Post a Comment