Directory / File Management
Creating a new folder/directory:
mkdir directoryname
Changing directory:
cd directoryname
Listing files and directories
ls
Moving files or directories
mv source destinations
Copying files or directories:
cp source destination
Removing files:
rm filename
Removing directories:
rm -r directoryname
Renaming files or directories:
mv oldname newname
Displaying the current working directory:
pwd
Creating an Empty File
touch filename
To display the contents of a single file:
cat filename.txt
To display the contents of multiple files:
cat file1.txt file2.txt
To display the contents of a file along with line numbers:
cat -n filename.txt
To concatenate multiple files and display the output:
cat file1.txt file2.txt > combined.txt
Last updated