Files & Directory Management
Command
Description
Example
ls
List files and directories.
ls → Lists files in the current directory.
cd
Change the current directory.
cd Documents → Changes to the Documents directory.
pwd
Print the working directory.
pwd → Outputs /home/user/Documents.
touch
Create an empty file.
touch file.txt → Creates an empty file named file.txt.
mkdir
Create a new directory.
mkdir new_folder → Creates a directory named new_folder.
cp
Copy files or directories.
cp file.txt backup.txt → Copies file.txt to backup.txt.
rm
Remove files or directories.
rm file.txt → Deletes file.txt.
rmdir
Remove directories.
rmdir empty_folder → Removes an empty directory named empty_folder.
mv
Move or rename files or directories.
mv oldname.txt newname.txt → Renames oldname.txt to newname.txt.
Last updated