Displays files and folders in the current directory.
ls # Basic listing
ls -l # Long listing format
ls -a # Show hidden files
Navigate between folders.
cd /path/to/folder
cd .. # Go up one level
cd ~ # Go to home directory
Shows the full path to your current location.
pwd
Duplicate files or entire directories.
cp file.txt /new/location/
cp -r folder/ /new/location/
Used for moving or renaming files.
mv oldname.txt newname.txt
mv file.txt /new/location/
Deletes files or folders permanently.
rm file.txt
rm -r folder/ # Delete a directory and its contents
Creates a new file or updates the timestamp of an existing one.
touch newfile.txt
Displays the entire content of a file.
cat file.txt
For long files, consider using less
or more
.
Gives you elevated privileges for administrative tasks.
sudo apt update
sudo rm -rf /restricted/area
Requires your user password.
Displays help documentation for commands.
man ls
man grep
Use the arrow keys to scroll, and q
to quit.
Combine commands with pipes and redirection:
ls -l | grep "filename"
echo "Hello" > file.txt