• Top 72 Often Used Linux Commands

    by  • May 26, 2012 • How-To • 0 Comments

    Linux Penguin

    1. Change file ownership recursively

    # chown -R user folder

    With group ownership

    # chown -R user:group folder

    2. View postfix or sendmail mail queue

    # mailq

    3. Abort a command

    Ctrl+C

    4. Create public-private rsa key pairs

    # ssh-keygen

    5. log out from your current shell

    Ctrl+D

    6. Sort a file in reverse

    # sort -r filename

    7. Transfer a file with scp

    # scp -C filename username@remotehost:destination_folder

    8. See last 100 lines of a file.

    # tail -100 filename

    9. Check your mail

    # mail

    10. Load a specific kernel module

    # modprobe modulename

    11. Remove a specific module from your kernel

    # rmmod modulename

    12. List all loaded kernel modules

    # lsmod

    13. Print out contents of a file

    # cat filename

    14. Create a symbolic link

    # ln -s target_directory/filename symbolic_link_name

    15. Show which group a user is a member of

    # groups username

    16. Create a new group

    # groupadd groupname

    17. Delete an existing group

    # groupdel groupname

    18. Delete a user

    # userdel -r username

    19. Show currently logged in users

    # users

    20. Show currently logged in users in more detail

    # w

    21. Mount a CD-rom drive

    # mount -t iso9660 /dev/scd0 /media/cdrom

    or

    # mount -t iso9660 /dev/cdrom /media/cdrom

    22. Unmount a CD drive

    # umount /dev/scd0

    or

    # umount /dev/cdrom

    23. Transfer and sync files or folders between two hosts

    # rync -avz files1 username@remotehost:destination_folder

    24. See the user you’re logged in as

    # logname

    25. Show quick history of commands by current user

    # history

    26. Clear your terminal

    # clear

    27. Pause or break 5 seconsd between each command

    # sleep 5

    28. SSH to a remote host
    ssh -l username remote_host

    29. Print the numeric identifier of your host

    # hostid

    30. Create a tar archive

    # tar cvf archivename.tar directoryname

    31. Extract a tar archive

    # tar xvf archivename.tar

    32. Create a gunzip (.gz) archive

    # gzip filename

    33. Extract a gunzip (.gz) archive

    # gzip -d filename.gz

    34. Display compression ratio of a gunzip archive

    # gzip -l filename.gz

    35. Create a bzip (.bz2) archive

    # bzip2 filename

    36. Extract a bzip (.bz2) archive

    # bzip2 -d filename.bz2

    37. Extract a .zip archive

    # unzip test.zip

    38. View contents of a zip file:

    # unzip -l filename.zip

    39. Search for in a file

    # grep -i "searchword" filename

    40. Search all files recursivly

    # grep -r "searchword" *

    41. Extract cabinet (.cab) files

    # cabextract

    42. Print Perl version

    # perl -V

    43. Print PHP version

    # php -v

    44. Show SSH version

    # ssh -V

    45. 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 -lh

    47. Display files in current folder, order files by when they were last modified

    # ls -lt

    48. Toggle between the last two directories

    # cd -

    49. Check status of a service

    # service servicename status

    E.g. HTTPD

    # service httpd status

    50. Check steatus of all installed services

    # service --status-all

    51. Start a service

    # service servicename start

    E.g. HTTPD

    # service httpd start

    52. Restart a service

    # service servicename restart

    E.g. HTTPD

    # service httpd restart

    53. Stop a service

    # service servicename stop

    E.g. HTTPD

    # service httpd stop

    54. Display disk space usage in human readable form (KB, MB, GB, etc)

    # df -h

    55. Display total, free and used memory and swap in megabytes

    # free -m

    56. Shutdown host

    # shutdown -h now

    57. Shutdown in 15 minutes

    # shutdown -h +15

    58. Reboot the system

    # reboot

    59. Kill all processes with name xx

    # killall xx

    60. Copy a file

    # cp filenamesource filenamedestination

    61. Move a file

    # mv filenamesource filenamedestination

    62. Delete a file

    # rm filename

    63. Delete files recursivly

    # rm -r folder/file

    64. Make a directory/folder

    # mkdir directoryname

    65. Find out where a specific command exists

    # whereis commandname

    66. Find out what a specific command does

    # whatis commandname

    67. Display manual page for a command

    # man commandname

    68. Change your password

    # passwd

    69. Change password of another user

    # passwd username

    70. Ping a remote host with only 10 packets

    # ping -c 10 remote_host

    71 Ping a remote host indeffinatly (Abort with Ctrl+C)

    # ping remote_host

    72. Download something from the internet

    # wget http://remote_host/file

    or with FTP

    # wget ftp://remote_host/file

    About

    I have been working in IT for a number of years with MSSQL and a lot of other software, and I've always had computers and technology as my #1 hobby! MCTS: SQL2008 - MCITP: DBA2008

    http://www.blogofchris.com

    Leave a Reply

    Your email address will not be published. Required fields are marked *