Linux test Flashcards
What command lists the contents of a directory in long format?
ls -l
How do you search for a string in files within a directory?
grep -r
What command displays the amount of disk space used and available on mounted filesystems?
df -h
How do you show all currently running processes on a system?
ps aux
What is the command to create a new directory?
mkdir
How do you check the last 10 lines of a file?
tail
What command changes file permissions?
chmod
How do you switch to the root user account?
sudo su or su -
What command displays the kernel version?
uname -r
How do you copy a file from one location to another?
cp
How do you create a new user on a Linux system?
sudo useradd
How do you set or change a user’s password?
sudo passwd
What command lists all users currently logged into the system?
who
How do you display information about a specific user?
id
What is the command to modify a user’s properties such as their home directory or shell?
sudo usermod
How do you delete a user and their home directory?
sudo userdel -r
How do you lock a user account?
sudo usermod -L
What file contains the list of users and their home directories?
/etc/passwd
How do you add a user to a group?
sudo usermod -aG
How do you check which groups a user belongs to?
groups
What command displays real-time system processes and their resource usage?
top
How do you kill a process by its PID?
kill
What command sends a kill signal to all processes with a given name?
pkill
How do you view the process tree?
pstree
What command shows system uptime and load averages?
uptime
How do you start a process in the background?
Append & to the command
How do you bring a background process to the foreground?
fg
What command lists all processes running for a particular user?
ps -u
How do you find the PID of a specific running process?
pidof
What signal is used to forcefully kill a process?
SIGKILL (kill -9 )
How do you check the IP address of your system?
ip addr or ifconfig
What command lists all active network connections and listening ports?
netstat -tuln
How do you display routing table information?
route or ip route
What is the command to test connectivity to another server?
ping
How do you transfer a file from one system to another using SSH?
scp user@:
What command shows network statistics including packet counts and errors?
netstat -s
How do you open a port for incoming traffic in the firewall (UFW)?
sudo ufw allow
What command lists all currently open ports and their corresponding services?
ss -tuln
How do you connect to a remote system via SSH?
ssh user@