what is a shell?
Gets command from the user and runs the command on OS.
$su [user-to-be-switched-to]
$man [command]: shows the manual of command
ex) $man sudo
In the highest, root directory. (This is not the same with root access.)
$ls: list directory contents
$cd [dir]: switches the current directory to [dir]
If [dir] is missing, it goes to your home directory.
ex) $cd ./temp
$pwd: Displays the present working directory name (present working directory)
$cat [files]: concatenates and displays files
rmdir [dir] :create/remove [dir]
$rm [files]: remove files
$rm -r
$mv [A][B]: Move file A to file B (rename and/or relocate A)
ex) $mv a.txt ~/tmp/ //relocate a.txt to b.txt
$mv a.txt b.txt //rename a.txt to b.txt
$mv a.txt ~/tmp/b.txt //rename and relocate a.txt
$mv ./tmp tmp2 //rename a directoty,
cf) ~/ : home directory
./ : current directory
exit/logout/ctrl-d: exits the shell or your current session
$clear: clears the screen
What is Environment Variables?
HOME ???
Hints: -h option
[command] -h
How to Execute a Program in Current Directory?
You should specify the directory
./program //GOOD!
Creating/Removing Directories
$mkdir/rmdir -p dir: creates/removes all intermediate directories in dir
ex) $mkdir newdir //works
$mkdir newdir/product/reviews //mkdir: cannot create directory
$mkdir -p newdir/product/reviews //works
$rmdir newdir //rmdir: failed to remove 'newdir': Directory not empty
$rm -rf newdir //works, -f means 'force'
other options
-a: all files including hidden files
-t: sort by modified time
-d: displays only directory names not their contents
-R: list files recursively
first character: file type
'-' regular type
'd' directory
'l' symbolic link (pointer file)
Permissions:
r: readable
w: writable
x: executable
Groups:
u: user텍스트
g: group
o: other