file and directory operations Flashcards
Assuming you are currently in a directory containing a directory named templates. What is the command to delete templates?
rm -R templates
What is the command to delete recursively a directory and all its content? Give an example for a directory named files.
rm -R files
What is the command to list the last 250 lines from a file called myfile.txt ?
(assuming you are currently in the directory of the file)
tail -n myfile.txt
What is the command to keep listing the last 250 lines from a file called myfile.txt as it changes?
(assuming you are currently in the directory of the file)
tail -f -n 250 myfile.txt
What is the command to restart a Linux server immediately?
reboot now
What is the command to get all the IP addresses associated with a Linux installation?
ip addr show
What is the nginx command to tell nginx to reload its config?
nginx -s reload
What is the command to remove the user deploy from the wheel group on rhel?
gpasswd -d deploy wheel
What is the command to see all the groups a user called deploy belongs to?
groups deploy
What is the command to tell Linux to start a service at boot time? Give an example for a service called HelloWorld.
sudo systemctl enable HelloWorld
If you have a service with the logical name HelloWorld what is the command to get the log entries only for that service?
sudo journalctl -u HelloWorld
What is the command to get the status of a service called HelloWorld?
sudo systemctl status HelloWorld
What is the command to start a service called HelloWorld?
sudo systemctl start HelloWord
Are directory and filename case sensitive in Linux?
yes
How do you stop a service called HelloWorld?
sudo systemctl stop HelloWorld
How do you reload the services config in linux?
sudo systemctl daemon-reload
What is the command to set the timezone to EST?
sudo timedatectl set-timezone America/Toronto
On a rhel linux system where are the .service files located?
/etc/systemd/system/
For example:
/etc/systemd/system/HelloWorld.service