Overview:
In this tutorial, we will cover the basics of the Unix file system.
We will also cover the commands that are used to work with the file system such as touch, cat, cp, mv, rm, mkdir, etc.
=> Click here for the Complete Unix Tutorial series
Unix Video #3:
#1) touch: Create a new file or update its timestamp.
- Syntax: touch [OPTION]…[FILE]
- Example: Create empty files called ‘file1’ and ‘file2’
- $ touch file1 file2
#2) cat: Concatenate files and print to stdout.
- Syntax: cat [OPTION]…[FILE]
- Example: Create file1 with entered cotent
- $ cat > file1
- Hello
- ^D
#3) cp: Copy files
- Syntax: cp [OPTION]source destination
- Example: Copies the contents from file1 to file2 and the contents of file1 are retained
- $ cp file1 file2
#4) mv: Move files or rename files
- Syntax: mv [OPTION]source destination
- Example: Create empty files called ‘file1’ and ‘file2’
- $ mv file1 file2
#5) rm: Remove files and directories
- Syntax: rm [OPTION]…[FILE]
- Example: Delete file1
- $ rm file1
#6) mkdir: Make a directory
- Syntax: mkdir [OPTION] directory
- Example: Create a directory called dir1
- $ mkdir dir1
#7) rmdir: Remove a directory
- Syntax: rmdir [OPTION] directory
- Example: Create empty files called ‘file1’ and ‘file2’
- $ rmdir dir1
#8) cd: Change directory
- Syntax: cd [OPTION] directory
- Example: Change working directory to dir1
- $ cd dir1
#9) pwd: Print the present working directory
- Syntax: pwd [OPTION]
- Example: Print ‘dir1’ if a current working directory is dir1
- $ pwd
Watch out more about Unix commands in the upcoming tutorial.
=> Click here for the Complete Unix Tutorial series