WorksheetsBasic Linux Commands for Beginners
Total questions: 16
Worksheet time: 8mins
What command is used to list files in a directory?
ls
dir
show
list
How do you change the current directory in Linux?
Use the 'cd' command followed by the directory path.
Execute 'dir' to list and change directories.
Type 'change dir' followed by the path.
Use the 'mv' command to move directories.
Which command shows the present working directory?
mkdir
pwd
cd
ls
What command would you use to create a new directory?
del
rmdir
mkdir
remove
How can you remove an empty directory in Linux?
Run 'delete
Use the command 'rm
Use the command 'rmdir
Execute 'rmdir -r
What command displays the contents of a file?
cat
display
show
list
How do you create an empty file in Linux?
create filename.txt
new file filename.txt
touch filename.txt
emptyfile -create
What command lists all files and directories, including hidden ones?
list -a
dir
ls -a
ls -l
Which command would you use to go back to the previous directory?
cd /
cd .
cd ..
cd ~
How can you check the current directory you are in?
Use 'ls' in Windows Command Prompt.
Check the properties of the folder.
Use 'pwd' in Unix/Linux or 'cd' in Windows Command Prompt.
Type 'current' in Unix/Linux.
What command would you use to create multiple directories (dir1 dir2 dir3) at once?
mkdir all dir1 dir2 dir3
mkdir dir1 dir2 dir3
create dir1 dir2 dir3
mkdir dir1; mkdir dir2; mkdir dir3
How do you delete a directory that is not empty?
Use 'rmdir
Use 'rm -r
Use 'rm
Delete the directory from the file explorer.
How do you rename a file in Linux?
Rename the file by editing its properties in the GUI.
Use the 'rm' command followed by 'touch' to create a new file with the desired name.
Use the 'mv' command to rename a file.
Use the 'cp' command to rename a file.
What command would you use to copy a file?
mv source_file destination_file
cp source_file destination_path
rm source_file destination_file
touch source_file destination_file
How can you move a file to a different directory?
Use the 'cp' command to copy the file instead.
Drag and drop the file in the file explorer.
Rename the file to move it to a different directory.
Use the 'mv' command followed by the source file path and the destination directory path.
How do you create a directory and navigate into it in one command?
mkdir new_directory && cd new_directory
cd new_directory new_directory
mkdir new_directory | cd new_directory
mkdir new_directory; cd new_directory
