Take control of Linux Flashcards
$ sudo [command]
For every command that requires root permission.
$ sudo su
Same as putting sudo in front of a command.
$ pwd
print working directory , or “where I am”.
$ ls
List the content of the current directory.
$ ls -a
List the content of the working directory, including hidden files.
$ cd [directory]
Change the current directory.
$ cd ..
Move to parent directory of current directory.
$ mkdir [directory]
Create a directory.
$ cp [source] [destination]
Copy and paste a file.
$ mv [source] [destination]
Move (rename) a file or directory.
$ cp -r [source] [destination]
$ Copy and paste a directory.
$ rm [file]
Remove file.
$ rm -rf [directory]
Recursive removal of directory.
$ cat [file]
cat means “concatenate”. View the content of a file.
$ cat [file] [file]
View the content of multiple files.
$ cat >[file]
Create a file.
$ cat [file1] > [file2]
Redirect standard output of file1 into new file2. Existing content of file2 will be overwritten.
$ cat [file1] >> [file2]
Append standard output of file1 into file2, without overwritting.
$ cat < [file]
Output of the file will be shown in terminal.
$ cd (or $ cd ~)
Navigate to home directory.
$ cd /
Navigate to root directory.
$ cd -
Navigate to previous directory.
$ ln -s [target] [source]
Create a symbolic link at [source] referencing the original file [target].
What is a symbolic link?
Also called soft link or symlink, it can be thought of as a shortcut to a file or directory.
- do