How to use shell (Linux Version) === - date It will print the date time - echo hello it will print hello - echo "Hello World" It will see this as one string argument and print it - echo Hello\ World --- It will print Hello World This always use at you want to go to some directory that have space in their file name. So you need to use\ to prevent you go to two directory. - echo $PATH It will show all the pass to search for programs - which echo **user/bin/echo** This will tell me where echo is , and if i want to run this program what directory i will pass On linux and MacOs the slash will be / and on windows this will be \ . - pwd **/home/shao** It will print working directory - cd /home change directory to home - cd .. .. means the parent directory . means the current directory - cd ./home Go to home that under the current directory. If they don't have home under your directory It will print **No such File or directory** - ls ls is short for list This will list all the files in the current directory - ls .. This will print the previous directory filhttps://hackmd.io/W9Y19XhCRzORoZTIFp7rMQ#es - cd ~ This will take you back to the home directory - cd - go back to the directory you are previous in. - ls - - help It will print out all the explain of command **ls** - ls -l 可以看現行的狀態下,個別使用者的權限,第一個是管理者、再來User跟所有人。d means this is directory。r=read、w=write、x=excute。前面若是-代表沒有權限使用那個方式。 If you have a permission to execute one directory, It means you are allow toe excute all the parents directory of this directory. for example , if i can use echo, it means i have authority to use user and can use bin so i can use echo. - mv **A** **B** move the files name of A to become B or move the files(A) to the directory(B) - rm **A** remove file A ( but you can't remove directory) - cp copy - rmdir remove directory (only when the directory is empty) - mkdir make directory (if you type more than one words please use \ to make this a directory not separate two) - man ls you can see the manual page of ls - ctrl+l clean all and go back to the top. - echo hello > hello.txt by default the terminal will be use of output. but we can also use other way to output things this function will make hello output inside hello.txt - cat hello.txt cat can show the letter in side the file. - cat <hello.txt >hello2.txt we can use this way to copy content in hello.txt to hello2.txt - cat <hello.txt >>hello2.txt the content inside hello will copy to the appendix of hello2.txt (it will be pad after the all files) - | take left as intput and right as outpu - ls -l / | tail n1 > ls.txt use tail n1 format to ouput ls -l / last line and store it inside ls.txt - grep global research and print it - sudo we don't always use as root user(super user or user0)in the computer, it will ruin your system. So if we want to use the power of root we will use sudo to make it. do as superuser --> sudo. - cd /sys you can go inside and see the kernel parameter - sudo su if you can see $ in your shell system it means you are still a formal user. if you want to do the following command as super user you can use sudo su(su means super user) and your shell will have # signal. you can use **exit** to exit this status. - tee put things inside file as standard output