Top 72 Often Used Linux Commands
by Chris • May 26, 2012 • How-To • 0 Comments
1. Change file ownership recursively
# chown -R user folderWith group ownership
# chown -R user:group folder2. View postfix or sendmail mail queue
# mailq3. Abort a command
Ctrl+C4. Create public-private rsa key pairs
# ssh-keygen5. log out from your current shell
Ctrl+D6. Sort a file in reverse
# sort -r filename7. Transfer a file with scp
# scp -C filename username@remotehost:destination_folder8. See last 100 lines of a file.
# tail -100 filename9. Check your mail
# mail10. Load a specific kernel module
# modprobe modulename11. Remove a specific module from your kernel
# rmmod modulename12. List all loaded kernel modules
# lsmod13. Print out contents of a file
# cat filename14. Create a symbolic link
# ln -s target_directory/filename symbolic_link_name15. Show which group a user is a member of
# groups username16. Create a new group
# groupadd groupname17. Delete an existing group
# groupdel groupname18. Delete a user
# userdel -r username19. Show currently logged in users
# users20. Show currently logged in users in more detail
# w21. Mount a CD-rom drive
# mount -t iso9660 /dev/scd0 /media/cdromor
# mount -t iso9660 /dev/cdrom /media/cdrom22. Unmount a CD drive
# umount /dev/scd0or
# umount /dev/cdrom23. Transfer and sync files or folders between two hosts
# rync -avz files1 username@remotehost:destination_folder24. See the user you’re logged in as
# logname25. Show quick history of commands by current user
# history26. Clear your terminal
# clear27. Pause or break 5 seconsd between each command
# sleep 528. SSH to a remote host
ssh -l username remote_host
29. Print the numeric identifier of your host
# hostid30. Create a tar archive
# tar cvf archivename.tar directoryname31. Extract a tar archive
# tar xvf archivename.tar32. Create a gunzip (.gz) archive
# gzip filename33. Extract a gunzip (.gz) archive
# gzip -d filename.gz34. Display compression ratio of a gunzip archive
# gzip -l filename.gz35. Create a bzip (.bz2) archive
# bzip2 filename36. Extract a bzip (.bz2) archive
# bzip2 -d filename.bz237. Extract a .zip archive
# unzip test.zip38. View contents of a zip file:
# unzip -l filename.zip39. Search for in a file
# grep -i "searchword" filename40. Search all files recursivly
# grep -r "searchword" *41. Extract cabinet (.cab) files
# cabextract42. Print Perl version
# perl -V43. Print PHP version
# php -v44. Show SSH version
# ssh -V45. Find a file by name
# find -iname "filename"46. Display files in current folder with filesize in human readable format (KB, MB, GB etc.,)
# ls -lh47. Display files in current folder, order files by when they were last modified
# ls -lt48. Toggle between the last two directories
# cd -49. Check status of a service
# service servicename statusE.g. HTTPD
# service httpd status50. Check steatus of all installed services
# service --status-all51. Start a service
# service servicename startE.g. HTTPD
# service httpd start52. Restart a service
# service servicename restartE.g. HTTPD
# service httpd restart53. Stop a service
# service servicename stopE.g. HTTPD
# service httpd stop54. Display disk space usage in human readable form (KB, MB, GB, etc)
# df -h55. Display total, free and used memory and swap in megabytes
# free -m56. Shutdown host
# shutdown -h now57. Shutdown in 15 minutes
# shutdown -h +1558. Reboot the system
# reboot59. Kill all processes with name xx
# killall xx60. Copy a file
# cp filenamesource filenamedestination61. Move a file
# mv filenamesource filenamedestination62. Delete a file
# rm filename63. Delete files recursivly
# rm -r folder/file64. Make a directory/folder
# mkdir directoryname65. Find out where a specific command exists
# whereis commandname66. Find out what a specific command does
# whatis commandname67. Display manual page for a command
# man commandname68. Change your password
# passwd69. Change password of another user
# passwd username70. Ping a remote host with only 10 packets
# ping -c 10 remote_host71 Ping a remote host indeffinatly (Abort with Ctrl+C)
# ping remote_host72. Download something from the internet
# wget http://remote_host/fileor with FTP
# wget ftp://remote_host/file
