Linux test Flashcards

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
Q

What command shows system uptime and load averages?

A

uptime

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

How do you start a process in the background?

A

Append & to the command

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

How do you bring a background process to the foreground?

A

fg

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

What command lists all processes running for a particular user?

A

ps -u

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

How do you find the PID of a specific running process?

A

pidof

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

What signal is used to forcefully kill a process?

A

SIGKILL (kill -9 )

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

How do you check the IP address of your system?

A

ip addr or ifconfig

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

What command lists all active network connections and listening ports?

A

netstat -tuln

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

How do you display routing table information?

A

route or ip route

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

What is the command to test connectivity to another server?

A

ping

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

How do you transfer a file from one system to another using SSH?

A

scp user@:

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

What command shows network statistics including packet counts and errors?

A

netstat -s

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

How do you open a port for incoming traffic in the firewall (UFW)?

A

sudo ufw allow

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

What command lists all currently open ports and their corresponding services?

A

ss -tuln

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

How do you connect to a remote system via SSH?

A

ssh user@

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

How do you check DNS resolution for a domain?

A

nslookup or dig

41
Q

How do you set a kernel parameter temporarily in Linux?

A

sysctl -w =

42
Q

How do you make a kernel parameter change persistent across reboots?

A

Edit /etc/sysctl.conf and add the parameter

43
Q

How do you view a list of currently running services on a system using systemd?

A

systemctl list-units –type=service

44
Q

What command is used to schedule a one-time job in the future?

A

at

45
Q

How do you install software using the apt package manager?

A

sudo apt install

46
Q

How do you list available software updates on a system using dnf?

A

sudo dnf check-update

47
Q

How do you start a Virtual Machine using libvirt?

A

virsh start

48
Q

What is the command to create a container using docker?

A

docker run

49
Q

How do you display the status of SELinux?

A

sestatus

50
Q

How do you change SELinux context of a file?

A

chcon

51
Q

How do you configure a static IP address using nmcli?

A

nmcli con mod ipv4.address ipv4.gateway ipv4.dns ipv4.method manual

52
Q

How do you enable IPv6 on an interface?

A

Edit /etc/network/interfaces or use nmcli to configure ipv6.method auto

53
Q

What command is used to set the system time and sync it using NTP?

A

timedatectl set-ntp true

54
Q

How do you restart the OpenSSH service on a system using systemd?

A

sudo systemctl restart sshd

55
Q

What command is used to add a firewall rule to allow traffic on a specific port using ufw?

A

sudo ufw allow

56
Q

How do you add a static route to the routing table?

A

ip route add / via

57
Q

How do you configure network bonding (link aggregation)?

A

Edit /etc/network/interfaces and define a bond with bonding options

58
Q

How do you set up a reverse proxy using nginx?

A

Configure a server block in /etc/nginx/nginx.conf or /etc/nginx/conf.d/default.conf with proxy_pass

59
Q

How do you check the status of network interfaces and active connections?

A

ip addr or nmcli device status

60
Q

How do you troubleshoot DNS resolution issues?

A

Use nslookup or dig to query DNS servers and verify configurations in /etc/resolv.conf

61
Q

How do you create a new logical volume in LVM?

A

lvcreate -L -n

62
Q

What command shows the available space and usage on all mounted filesystems?

A

df -h

63
Q

How do you format a new partition with the ext4 filesystem?

A

mkfs.ext4 /dev/

64
Q

What command do you use to mount a remote NFS filesystem?

A

mount -t nfs :/ /mnt/

65
Q

How do you check the performance of your storage device?

A

iostat or iotop

66
Q

How do you create a swap partition or file on a Linux system?

A

Use mkswap /dev/ for a partition or dd to create a swap file and then mkswap

67
Q

How do you enable a swap partition on boot?

A

Add the swap partition to /etc/fstab

68
Q

What is the command to check the health of a filesystem?

A

fsck /dev/

69
Q

How do you configure an automounter for NFS in /etc/auto.master?

A

Add the automount configuration to /etc/auto.master and specify the NFS share in a corresponding map file

70
Q

How do you extend an existing LVM logical volume?

A

lvextend -L + /dev//

71
Q

How do you clone a Git repository to your local machine?

A

git clone

72
Q

How do you check the status of a service using systemctl?

A

systemctl status

73
Q

What is the command to display CPU and memory usage in real-time?

A

top or htop

74
Q

How do you troubleshoot disk space issues on a Linux system?

A

Use df -h to check disk usage

75
Q

How do you generate an SSL certificate using OpenSSL?

A

openssl req -new -x509 -key -out -days

76
Q

How do you restart a service on a system using systemctl?

A

sudo systemctl restart

77
Q

How do you display all running services and their statuses on a systemd system?

A

systemctl list-units –type=service

78
Q

How do you display the amount of free and used memory on a system?

A

free -h

79
Q

How do you enable and start a service on boot?

A

sudo systemctl enable –now

80
Q

What is the command to check system performance metrics

A

such as CPU

81
Q

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

A

sudo useradd

82
Q

How do you set resource limits for a user in Linux?

A

Edit /etc/security/limits.conf to set limits such as maximum open files

83
Q

How do you assign a password to a user?

A

sudo passwd

84
Q

How do you list all users and groups on a system?

A

View /etc/passwd for users and /etc/group for groups

85
Q

What is the command to modify an existing user’s properties?

A

usermod

86
Q

How do you configure system-wide environment variables?

A

Edit /etc/profile or /etc/environment

87
Q

What file is used to set environment variables for a specific user?

A

~/.bashrc or ~/.bash_profile

88
Q

How do you set Access Control Lists (ACLs) for a file or directory?

A

setfacl -m u::rwx

89
Q

How do you configure a Linux system to use LDAP for user accounts?

A

Install libnss-ldap and configure /etc/nsswitch.conf and /etc/ldap.conf

90
Q

How do you delete a user and their home directory?

A

sudo userdel -r

91
Q

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

A

usermod

92
Q

What command shows network statistics, including packet counts and errors?

A

ifconfig or ip -s link

93
Q

How do you make a kernel parameter change persistent across reboots?

A

Edit /etc/sysctl.conf and add the parameter, then run sysctl -p

94
Q

How do you configure network bonding (link aggregation)?

A

Edit /etc/network/interfaces and define a bond with bonding options, or use nmcli with teamd or bond settings

95
Q

How do you extend an existing LVM logical volume?

A

lvextend -L +<size> /dev/<vg_name>/<lv_name>, followed by resize2fs /dev/<vg_name>/<lv_name> to resize the filesystem</lv_name></vg_name></lv_name></vg_name></size>

96
Q

How do you troubleshoot disk space issues on a Linux system?

A

Use df -h to check disk usage, du -sh to check directory sizes, and lsof to see open files using disk space

97
Q

What is the command to check system performance metrics, such as CPU, memory, and I/O statistics?

A

vmstat, iostat, or sar

98
Q

How do you set resource limits for a user in Linux?

A

Edit /etc/security/limits.conf to set limits such as maximum open files, memory, etc.