LinuxOlympics CommonCommands
LinuxOlympics CommonCommands
In this event you will exercise your skills at the Linux command line, completing several qualifying events.
Question 1
Common Commands (1)
Question The 'ls' command is used to list files.
List the files in your home directory.
Hint Run the 'ls' command to list the files in your starting directory.
Answer ls
Question 2
Common Commands (2)
Question The 'cat' command is used to display the contents of a file.
Display the contents of the fencing.txt file.
Hint Run 'cat fencing.txt' to display the file. This command works best for text-based files.
Answer cat fencing.txt
Question 3
Common Commands (3)
Question In Linux, files that begin with a . are hidden by default.
List the hidden and non-hidden files in your home directory using 'ls -a'.
Hint Run 'ls -a' to see hidden files.
Answer ls -a
Question 4
Common Commands (4)
Question
Display the contents of the .fencingfact1.txt file.
Hint Run 'cat .fencingfact1.txt' to display the file.
Answer cat .fencingfact1.txt
Question 5
Common Commands (5)
Question The 'pwd' command prints the name of the working directory.
Identify the current directory name.
Hint Run 'pwd' to print the present working directory.
Answer pwd
Question 6
Common Commands (6)
Question The 'cd' command is used to change to a new directory.
Change to the epee directory.
Hint Run 'cd epee' to change to the epee directory.
Answer cd epee
Question 7
Common Commands (7)
Question
Display the fencing fact in the epee directory.
List files using 'ls'; you can dispay hidden files by running 'ls -a'. Then, use 'cat
Hint
.fencingfact2.txt' to display the hidden file contents.
Answer cat .fencingfact2.txt
Question 8
Common Commands (8)
Question The 'mkdir' command is used to create a new directory
Create a directory called bout, then change to the new directory.
Run 'mkdir bout' to create the bout directory, then run 'cd bout' to change to the new
Hint
directory.
Answer mkdir bout then cd bout
Question 9
Common Commands (9)
Question Running 'cd' with no arguments returns to the home directory.
Return to the home directory.
Hint Run 'cd' with no arguments to return to the user home directory.
Answer cd
Question 10
Common Commands (10)
Question The 'whoami' command will display your user name.
What is your user name?
Hint Run 'whoami' to display your user name.
Answer whoami
Question 11
Common Commands (11)
Question The 'id' command displays your user name, user ID, and group information.
What is your user ID?
Hint Run the 'id' command to display your user ID information.
Answer id
Question 12
Common Commands (12)
Question
Display the fencing fact in the foil directory.
Run 'cd' to go back to your home directory, then change to the foil directory and cat the
Hint
file.
cd, then cd foil. List files with ls, then display the fencing fact with cat
Answer
fencingfact3.txt
Question 13
Common Commands (13)
Question
Display the final fencing fact in the sabre directory.
Run 'cd' to go back to your home directory, then change to the sabre directory and cat the
Hint
file.
cd, then cd sabre. List files with ls, then display the fencing fact with cat
Answer
fencingfact4.txt
Question 14
Common Commands (14)
Question The 'rm' command is used to remove files.
Remove the fencingfact4.txt file.
Hint Run 'rm fencingfact4.txt'
Answer rm fencingfact4.txt
Question 15
Common Commands (15)
Question The 'mv' command is used to move a file to a new directory.
Change to the foil directory. Move the fencingfact3.txt file to /tmp.
Run 'cd ../foil' to change to the foil directory, then run 'mv fencingfact3.txt /tmp' to move
Hint
the file to the /tmp directory.
Answer cd ../foil, then mv fencingfact3.txt /tmp
Question 16
Common Commands (16)
Question The 'mv' command is also used to rename files.
Change to the /tmp directory, then rename the fencingfact3.txt file to fact.txt
Run 'cd /tmp' to change to the /tmp directory, then run 'mv fencingfact3.txt fact.txt' to
Hint
rename the file.
Answer cd /tmp then mv fencingfact3.txt fact.txt