Wednesday, December 28, 2011

Unix Tools - Commands Basic and Advance

( recommend : ctrl+f to search keyword or command you want )
Unix Command :


  1. ls -> show contents of current directory
  2. ls -l -> show as list with some detail
  3. ls -la -> show as list with more detail, size(byte)
  4. ls -i * -> to show all file's inode number
  5. dir -> show contents of current directory(cmd)
  6. cd direcotry -> go to directory
  7. cd .. -> go to back tree parent of current directory
  8. cd / -> go to root directory
  9. cd ~ -> go to home directory
  10. cd ${HOME} -> go to home directory
  11. vi file -> make new file or edit file with vi editor
  12. pico file -> make new file or edit file with pico editor
  13. mkdir directory .. -> make new directorys
  14. mkdir [my\ name] -> make new directory with name space
  15. rm files .. -> remove or delete files
  16. rm directory .. -> remove directory (directory must be empty)
  17. rm -r directory.. -> force remove directory even is not empty
  18. mv file1 file2 -> rename file1 to file2 in the same directory
  19. mv file1 dir/file1 -> move file1 to dir/ in current directory as file1
  20. cp file1 file2 -> copy file1 past file2 in the same directory
  21. cp file1 dir/file1 -> copy file1 to past in dir/ in current directory as file1
  22. cat file -> view file content without editing
  23. cat -n file -> view file with line number
  24. last -> show time of login on current server
  25. last -20 -> show time of login on current server by 20 last users
  26. w -> show who is currently logged in/out server (what user doing)
  27. who -> show who ..... (show ip)
  28. man xxx -> help for xxx command
  29. logout -> logout of server
  30. ssh user@hostname -> ssh to a host
  31. date -> show date time
  32. command1 ; command2 -> using multiple command by ";"
  33. chmod +xwr files ... -> change permission of files x:execute w:write r:read for all
  34. chmod u+??? files ... -> change permission for user ( +:add , -:remove , o:other , g:group)
  35. pwd -> show where you are now ($PWD)
  36. echo -> display a line of text
  37. echo [option] [string]
    -> echo -n Hello World (-n : no newline after string)
    Hello World
  38. passwd -> change password of user
  39. zip archivefile.zip file1 file2 ... -> compression file as zip
  40. unzip archivefile.zip -> extract file zip
  41. sftp [username]@[host]-> upload file from remote to host
    1. Ex. I using my macbook to connect with http://bangpra.informatics.buu.ac.th with my username
    2. Open terminal
      1. $> sftp username@bangpra.informatics.buu.ac.th
      2. password: ____
      3. sftp> ? // to get help
        1. using l__ for remote
        2. using __ for host
        3. using get to download file from host to remote
        4. using put to upload file from remote to host
  42. curl -o [URL] -> download file to into current directory from URL
  43. wget [URL] -> download file or directory into current directory
  44. wget -r [URL] -> download directory from URL to current directory
  45. export PS1="change hosting name $" >> change user display
  46. du -sh ${HOME} >> show disk usage from tree HOME
  47. find ${HOME} -type f -size +1M -print | xargs ls -lh >> find file bigger >= 1MB from tree HOME
  48. find ${HOME} -type f ! -name '*.mp3' -exec grep -l -- "findstring" {} \; >> to find findstring is contents in files which is not *.mp3 from tree HOME
  49. tar -cvjf archive.tar.bz2 files...Compression file *.tar.bz2
  50. tar -xvjf archive.tar.bz2 files...Extract file *.tar.bz2
  51. tar -tvjf archive.tar.bz2 files...List archive file *.tar.bz2
  52. tar -cvzf archive.tar.gz files...Compression file *.tar.gz
  53. tar -xvzf archive.tar.gz files...Extract file *.tar.gz
  54. tar -tvzf archive.tar.gz files...List archive file *.tar.gz
  55. tar -cvJf archive.tar.xz files...Compression file *.tar.xz
  56. tar -xvJf archive.tar.xz files...Extract file *.tar.xz
  57. tar -tvJf archive.tar.xz files...List archive file *.tar.xz
  58. ln source_file hlink_file...Make a hard link to source file
  59. ln -s source_file slink_file...Make a soft link / symbolic link to source file
  60. stat [option] <filename>... show file information
  61. od [option] <base> <binaryfile>...show content binary file Ex1. od -t x1 file.pdf ... show to show file.pdf as one byt

No comments:

Post a Comment