- '>' after a command : create and save the output in a file
- Command 'cat' : displays the content of a text file.
- '>>' : appends output(already exists) / create and write to a new file(doesn't exist)
- '<' : redirect input
It is possible to mix "<" and ">" together in a single line!
Pipeline feeds output of previous command to input of 'next' command. ex) command1 | command2 | command3 ....
$ ls -lh | lessPress "q" : exit the screen.
$ ls | wc -l
7
$"wc - l" : displays the number of files in the current directory.
$ echo my name is dongeun
my name is dongeun
$"echo" : print the text after command 'echo'.
$ echo *" echo * " : print the files that exist in the current directory. (same function as '-ls')
Tip : Bachslash bachslash: ignore line change (enter) to enter a long command in multiple lines.
Files and directories have a permission assigned differently to owner, group, ohters.
-> read with 3 letters at a time -> 'rwx' means: Read, Write, and Execution
-
'-': File type
'-': indicates regular file 'd': indicates directory
-
1st 'rwx': permissions for the file owner.
-
2nd 'rwx': permissions for the group owner of the file
-
3rd 'rwx': permissions for all other users.
Use command "chmod" to change permissions.
[me@linuxbox me]$ chmod 600 some_file"600" means 6 = 110 = rw- for owners (owners can read and write the file) 0 = 000 = - - - for group (group owner can't read, write, and execute the file.) 0 = 000 = - - - for others (all other users can't read, write, and execute the file.)
We can grant various permissions by combining three numbers using binary numbers.
A superuser has all system administation authority!
Put "Sudo" before the command to use superuser's authority.
[me@linuxbox me]$ sudo some_commandif you want use superuser's authority continuously, use "-i"
[me@linuxbox me]$ sudo -iType "exit" : get out of a superuser session.
This is used to store commands in advance and execute them sequentially whenever necessary.
$ nano myscript.shehco "Hello Shell Script!"$ sh myscript.sh
Hello Shell Script!
$