Linux Interview Questions Flashcards

1
Q

How to check the kernel version of a Linux system?

A

uname -a
uname -v
unmae -r

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

How to see the current IP address on Linux?

A

ifconfig
OR
ip addr show

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

How to check for free disk space in Linux?

A

df -ah

a: all file system
h: human readable

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

How to see if a Linux service is running?

A

Older systems: service service_name status

Newer Systems: systemctl status service_name

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

How to check the size of a directory in Linux?

A

du -sh directory_name

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

How to check for open ports in Linux?

A

netstat -tupln

t: tcp
u: udp
p: program
l: listening
n: numerical value instead of host/user name

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

How to check Linux process information(CPU usage, memory, user information, etc.)?

A

ps -aux | grep process_name
top
htop
atop

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

How to deal with mounts in Linux

A

mount
ex: mount /dev/sda2 /mnt
fstab: Automatic boot time mounting
Location: /etc/fstab

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

How do you look stuff up?

A

Man pages
Stack overflow
Google
Official documentation

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

What is an init system?

A

The first special process that the kernel starts
init starts all the other services
init re-parents orphaned processes

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

What a linux user is made of ?

A

An entry in the following files:

  • /etc/group
  • / etc/shadow
  • /etc/passwd
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What do you know about proc?

What can you do with proc?

A

Kernel state presented as a file system tree
Find information about processes
Something wrong about processes
Troubleshooting

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

How to connect to a machine on the cloud?

A

Is there a VPN involved?
ssh to connect to remote hosts
ex: ssh root@ipaddress
Authentication with a password, key

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

How to copy a file to a remote host?

A

rsync username@ipaddress:/username/home/mytextfile.txt

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

What’s the difference between starting and enabling a service?

A

Starting is for that one time

Enabling is to start at boot time or whatever is defined

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

How to show the default route/default gateway?

A

ip route show

17
Q

How do you deal with logging?

A

via journalctl
journalctl -fu
journalctl -xe : for adding explanation to errors

18
Q

How to deal with a weird process?

How to find out more about it?

A

top/htop/atop
See the binaries: ps aux | grep
Poke /proc to see what that command was called with
lsof -p : file handles and network sockets
netstat or ss

19
Q

What can prevent you from creating a file?

A

Incorrect ownership / permissions

inode exhaustion