[SYNTAX] Working with Directories and Files
[SYNTAX] Working with Directories and Files
Create Directory
Change Directory
Remove Directory
Creating a File
Appending to a File
Renaming or Moving a File
Copying a File
Deleting a File
To go back to home Directory
To go back to previous working directory
To view contents of a File
To view and edit a file
- Code:
$ mkdir mydocs
Change Directory
- Code:
$ cd mydocs
Remove Directory
- Code:
$ rm -r mydocs
Creating a File
- Code:
$ cat > 1.txt
<file contents>
[ctrl + D]
Appending to a File
- Code:
$ cat >> 1.txt
<Text to be appended>
[ctrl + D]
Renaming or Moving a File
- Code:
$ mv 1.txt 1.x
Copying a File
- Code:
$ cp 1.txt 2.txt
Deleting a File
- Code:
$ rm 1.txt
To go back to home Directory
- Code:
$ cd ~
To go back to previous working directory
- Code:
$ cd ~-
To view contents of a File
- Code:
$ cat 1.txt
To view and edit a file
- Code:
$ vi 1.txt
Similar topics
» [SYNTAX] sed command
» [SYNTAX] tr command
» [SYNTAX] grep command
» copying file contents across directories
» [ SYNTAX ] Control Structures in Shell
» [SYNTAX] tr command
» [SYNTAX] grep command
» copying file contents across directories
» [ SYNTAX ] Control Structures in Shell
Permissions in this forum:
You cannot reply to topics in this forum