Linux Command Practice Simulator
- Read the task.
- Type the Linux command you think is correct.
- Click Run Command.
- If unsure, click Show Correct Answer.
- You can click Help & Learn Commands to study all Linux commands used in this lab.
Linux Commands Learning Guide
pwd
Print Working Directory. Shows the full path of your current directory.
Example: pwd
ls
Lists files and folders in the current directory.
Example: ls
ls -la
Lists all files including hidden ones and shows detailed information like permissions and size.
Example: ls -la
ls -lh
Lists files with detailed information and displays file sizes in human-readable format (KB, MB, GB).
Example: ls -lh
mkdir
Creates a new directory.
Example: mkdir test-dir-1
mkdir test-dir-1/test-subdir-1
Creates a subdirectory inside another directory.
Example: mkdir test-dir-1/test-subdir-1
cd
Changes the current directory.
Example: cd test-dir-1
cd ..
Moves one level up to the parent directory.
Example: cd ..
cd ../..
Moves two levels up in the directory structure.
Example: cd ../..
touch
Creates an empty file.
Example: touch file1.txt
cat
Displays the contents of a file.
Example: cat file1.txt
rm
Deletes a file.
Example: rm file1.txt
which
Shows where a command program is located.
Example: which cat
file
Identifies the type of a file.
Example: file /usr/bin/cat
Linux File Management Commands
touch <filename>
Creates a new empty file in the current directory.
Example:
touch notes.txt
This creates an empty file called notes.txt.
cp <source> <destination>
Copies a file or directory from one location to another. The copied file will contain the same data as the original.
Example:
cp notes.txt backup.txt
This creates a copy of notes.txt named backup.txt.
mv <source> <destination>
Moves a file or directory to another location. It is also used to rename files.
Example (rename a file):
mv notes.txt mynotes.txt
This renames notes.txt to mynotes.txt.
rm <filename>
Deletes a file from the file system.
Example:
rm notes.txt
This removes the file notes.txt.
nano <filename>
Opens the Nano text editor to create or edit a file.
Example:
nano notes.txt
This opens the file notes.txt in the Nano editor where you can write and edit text.
cat <filename>
Displays the contents of a file in the terminal window.
Example:
cat notes.txt
This prints the contents of notes.txt on the screen.
Exercise – Manage Files in the File System
Type the Linux command for each task.
cpruser@ubuntu:~$Exercise – Hidden Files
Type the Linux command to complete each task.
cpruser@ubuntu:~$
Exercise – Finding Information in the File System
Type the Linux command for each task and test your answer.
cpruser@ubuntu:~$
Exercise – Installing Software with APT
Type the Linux command for each task and test your answer.
cpruser@ubuntu:~$
Post a Comment
Please do not enter any spam links in the comments...