TEXT   38

linux commands

Guest on 24th January 2023 01:57:57 AM


  1. //linux commands
  2. compgen -c will list all the commands you could run.
  3. compgen -a will list all the aliases you could run.
  4. compgen -b will list all the built-ins you could run.
  5. compgen -k will list all the keywords you could run.
  6. compgen -A function will list all the functions you could run.
  7. compgen -A function -abck will list all the above in one go.
  8.  
  9. compgen -ac | wc -l
  10.  
  11. The following command can be executed in Terminal mode and shell programming.
  12.  
  13.  
  14. //clear screen
  15. clear
  16.  
  17. //help all commands
  18. //command --help
  19. ls --help
  20.  
  21. //manual for all commands
  22. //man command
  23. man ls
  24.  
  25. //creating soft links
  26. ln -s sourceDir targetName  
  27. do a ls to show how it is displayed
  28.  
  29. //list directory
  30. ls                        
  31. ls -la
  32.  
  33. //wildcards
  34. ls *.c
  35.  
  36. //make directory
  37. mkdir name
  38.     //relative vs absolute locations
  39. mkdir ../name
  40.  
  41. //change directory
  42. cd ../   ../../  ~   /  etc
  43.  
  44. //what is a file, type of files
  45. //create files
  46. touch fileName
  47.  
  48. //display a file
  49. cat fileName
  50.  
  51. //display parts of a file
  52. head -5 fileName
  53. tail -5 fileName
  54.  
  55. //pipe, simple
  56. cat fileName | less
  57. cat fileName | more
  58.  
  59. //copy  
  60. //can use multiple locations types (relative, absolute)
  61. cp sourceFile destinationFile
  62.  
  63. //rename - move  
  64. //can use multiple locations types (relative, absolute)
  65. mv sourceFile destinationFile
  66.  
  67. //delete file
  68. rm fileName
  69.  
  70. //delete folder
  71. //most be empty
  72. rmdir directoryName
  73.  
  74. //locate files
  75. locate *.tmp
  76.  
  77. //find files
  78. find -name
  79.  
  80. //redirecting output
  81. locate *.c > cPrograms
  82.  
  83. //parsing files
  84. grep a *.*

Raw Paste


Login or Register to edit or fork this paste. It's free.

">