Linux test Flashcards

(98 cards)

1
Q

What command lists the contents of a directory in long format?

A

ls -l

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you search for a string in files within a directory?

A

grep -r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What command displays the amount of disk space used and available on mounted filesystems?

A

df -h

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you show all currently running processes on a system?

A

ps aux

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the command to create a new directory?

A

mkdir

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you check the last 10 lines of a file?

A

tail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What command changes file permissions?

A

chmod

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you switch to the root user account?

A

sudo su or su -

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What command displays the kernel version?

A

uname -r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you copy a file from one location to another?

A

cp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you create a new user on a Linux system?

A

sudo useradd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you set or change a user’s password?

A

sudo passwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What command lists all users currently logged into the system?

A

who

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you display information about a specific user?

A

id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the command to modify a user’s properties such as their home directory or shell?

A

sudo usermod

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you delete a user and their home directory?

A

sudo userdel -r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How do you lock a user account?

A

sudo usermod -L

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What file contains the list of users and their home directories?

A

/etc/passwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do you add a user to a group?

A

sudo usermod -aG

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How do you check which groups a user belongs to?

A

groups

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What command displays real-time system processes and their resource usage?

A

top

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do you kill a process by its PID?

A

kill

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What command sends a kill signal to all processes with a given name?

A

pkill

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

How do you view the process tree?

A

pstree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What command shows system uptime and load averages?
uptime
26
How do you start a process in the background?
Append & to the command
27
How do you bring a background process to the foreground?
fg
28
What command lists all processes running for a particular user?
ps -u
29
How do you find the PID of a specific running process?
pidof
30
What signal is used to forcefully kill a process?
SIGKILL (kill -9 )
31
How do you check the IP address of your system?
ip addr or ifconfig
32
What command lists all active network connections and listening ports?
netstat -tuln
33
How do you display routing table information?
route or ip route
34
What is the command to test connectivity to another server?
ping
35
How do you transfer a file from one system to another using SSH?
scp user@:
36
What command shows network statistics including packet counts and errors?
netstat -s
37
How do you open a port for incoming traffic in the firewall (UFW)?
sudo ufw allow
38
What command lists all currently open ports and their corresponding services?
ss -tuln
39
How do you connect to a remote system via SSH?
ssh user@
40
How do you check DNS resolution for a domain?
nslookup or dig
41
How do you set a kernel parameter temporarily in Linux?
sysctl -w =
42
How do you make a kernel parameter change persistent across reboots?
Edit /etc/sysctl.conf and add the parameter
43
How do you view a list of currently running services on a system using systemd?
systemctl list-units --type=service
44
What command is used to schedule a one-time job in the future?
at
45
How do you install software using the apt package manager?
sudo apt install
46
How do you list available software updates on a system using dnf?
sudo dnf check-update
47
How do you start a Virtual Machine using libvirt?
virsh start
48
What is the command to create a container using docker?
docker run
49
How do you display the status of SELinux?
sestatus
50
How do you change SELinux context of a file?
chcon
51
How do you configure a static IP address using nmcli?
nmcli con mod ipv4.address ipv4.gateway ipv4.dns ipv4.method manual
52
How do you enable IPv6 on an interface?
Edit /etc/network/interfaces or use nmcli to configure ipv6.method auto
53
What command is used to set the system time and sync it using NTP?
timedatectl set-ntp true
54
How do you restart the OpenSSH service on a system using systemd?
sudo systemctl restart sshd
55
What command is used to add a firewall rule to allow traffic on a specific port using ufw?
sudo ufw allow
56
How do you add a static route to the routing table?
ip route add / via
57
How do you configure network bonding (link aggregation)?
Edit /etc/network/interfaces and define a bond with bonding options
58
How do you set up a reverse proxy using nginx?
Configure a server block in /etc/nginx/nginx.conf or /etc/nginx/conf.d/default.conf with proxy_pass
59
How do you check the status of network interfaces and active connections?
ip addr or nmcli device status
60
How do you troubleshoot DNS resolution issues?
Use nslookup or dig to query DNS servers and verify configurations in /etc/resolv.conf
61
How do you create a new logical volume in LVM?
lvcreate -L -n
62
What command shows the available space and usage on all mounted filesystems?
df -h
63
How do you format a new partition with the ext4 filesystem?
mkfs.ext4 /dev/
64
What command do you use to mount a remote NFS filesystem?
mount -t nfs :/ /mnt/
65
How do you check the performance of your storage device?
iostat or iotop
66
How do you create a swap partition or file on a Linux system?
Use mkswap /dev/ for a partition or dd to create a swap file and then mkswap
67
How do you enable a swap partition on boot?
Add the swap partition to /etc/fstab
68
What is the command to check the health of a filesystem?
fsck /dev/
69
How do you configure an automounter for NFS in /etc/auto.master?
Add the automount configuration to /etc/auto.master and specify the NFS share in a corresponding map file
70
How do you extend an existing LVM logical volume?
lvextend -L + /dev//
71
How do you clone a Git repository to your local machine?
git clone
72
How do you check the status of a service using systemctl?
systemctl status
73
What is the command to display CPU and memory usage in real-time?
top or htop
74
How do you troubleshoot disk space issues on a Linux system?
Use df -h to check disk usage
75
How do you generate an SSL certificate using OpenSSL?
openssl req -new -x509 -key -out -days
76
How do you restart a service on a system using systemctl?
sudo systemctl restart
77
How do you display all running services and their statuses on a systemd system?
systemctl list-units --type=service
78
How do you display the amount of free and used memory on a system?
free -h
79
How do you enable and start a service on boot?
sudo systemctl enable --now
80
What is the command to check system performance metrics
such as CPU
81
How do you create a new user on a Linux system?
sudo useradd
82
How do you set resource limits for a user in Linux?
Edit /etc/security/limits.conf to set limits such as maximum open files
83
How do you assign a password to a user?
sudo passwd
84
How do you list all users and groups on a system?
View /etc/passwd for users and /etc/group for groups
85
What is the command to modify an existing user's properties?
usermod
86
How do you configure system-wide environment variables?
Edit /etc/profile or /etc/environment
87
What file is used to set environment variables for a specific user?
~/.bashrc or ~/.bash_profile
88
How do you set Access Control Lists (ACLs) for a file or directory?
setfacl -m u::rwx
89
How do you configure a Linux system to use LDAP for user accounts?
Install libnss-ldap and configure /etc/nsswitch.conf and /etc/ldap.conf
90
How do you delete a user and their home directory?
sudo userdel -r
91
What is the command to modify a user's properties, such as their home directory or shell?
usermod
92
What command shows network statistics, including packet counts and errors?
ifconfig or ip -s link
93
How do you make a kernel parameter change persistent across reboots?
Edit /etc/sysctl.conf and add the parameter, then run sysctl -p
94
How do you configure network bonding (link aggregation)?
Edit /etc/network/interfaces and define a bond with bonding options, or use nmcli with teamd or bond settings
95
How do you extend an existing LVM logical volume?
lvextend -L + /dev//, followed by resize2fs /dev// to resize the filesystem
96
How do you troubleshoot disk space issues on a Linux system?
Use df -h to check disk usage, du -sh to check directory sizes, and lsof to see open files using disk space
97
What is the command to check system performance metrics, such as CPU, memory, and I/O statistics?
vmstat, iostat, or sar
98
How do you set resource limits for a user in Linux?
Edit /etc/security/limits.conf to set limits such as maximum open files, memory, etc.