Simple Linux Questions


Base on: Linux System Administrator/DevOps Interview Questions
This page contains ideas on how to answer questions. The answers are not absolutely accurate, please, consider to double-check yourself.

What is the name and the UID of the administrator user?


UID (user identifier) is a number assigned by Linux to each user on the system. This number is used to identify the user to the system and to determine which system resources the user can access. UIDs are stored in the /etc/passwd file Groups in Linux are defined by GIDs (group IDs)

How to list all files, including hidden ones, in a directory?

1ls --all  - do not ignore entries starting with .  (-a)

What is the Unix/Linux command to remove a directory and its contents?

1rmdir - only empty directories
2rm -rf dir

Which command will show you free/used memory? Does free memory exist on Linux?

1free -m
2Free memory does exist on linux

How to search for the string "my konfu is the best" in files of a directory recursively?

1grep -liR "my konfu is the best" ????

How to connect to a remote server or what is SSH?

ssh user@server

Secure Shell is a software standard to support encrypted data transfer between two computers. It can be used to support secure logins, file transfers or general purpose connects.

How to get all environment variables and how can you use them?

1printenv - print all or part of environment

I get "command not found" when I run ifconfig -a. What can be wrong?

net-tools is not installed

What happens if I type TAB-TAB?

the shell will automatically fill in the rest or show you the available options you can type (tab completion)

What command will show the available disk space on the Unix/Linux system?

1df -h
2df - report file system disk space usage

What commands do you know that can be used to check DNS records?

1dig ( dig [server] [name] [type]  
2dig MX )
3nsloockup ( nslookup -type=ns )
4host (host -t ns

What Unix/Linux commands will alter a files ownership, files permissions?

1chown - change file owner and group
2chmod - change file mode bits

What does chmod +x FILENAME do?

make it executable

What does the permission 0750 on a file mean?

0750 - owner=Read,Write,Execute - group=Read,Execute - other=No Permission

What does the permission 0750 on a directory mean?

0750 - owner=Read,Write,Open - group=Read,Open - other=No Permission

The directory owner has full access. Group users may list the directory, but cannot create files. Nobody else has any rights.

How to add a new system user without login permissions?

1 useradd -M username ( Do no create the user's home directory )
2 usermod -L username ( lock the account to prevent logging in )
3 useradd -r username ( does not have a password, a home dir and is unable to login )

How to add/remove a group from a user?

1usermod -a -G group user ( adding a user to a group )
2gpasswd -a user group
4gpasswd -d user group
5deluser user group
6usermod -G "" username ( removes all secondary/supplementary groups from username )

What is a bash alias?

An alias is a (usually short) name that the shell translates into another (usually longer) name or command

How do you set the mail address of the root/a user?

3P.S. for postfix: set in => myhostname =

What does CTRL-c do?

CTRL+C is used to kill a process with the signal SIGINT, and can be intercepted by a program so it can clean its self up before exiting, or not exit at all

What does CTRL-d do?

Ctrl-D tells the terminal that it should register a EOF on standard input, which bash interprets as a desire to exit

What does CTRL-z do?

CTRL+Z is used for suspending a process by sending it the signal SIGSTOP, which cannot be intercepted by the program.

What is in /etc/services?

/etc/services file contains a list of network services and ports mapped to them.

How to redirect STDOUT and STDERR in bash? (> /dev/null 2>&1)

1command > file-name 2>&1
2ls /tmp > /dev/null 2>&1

What is the difference between UNIX and Linux.

Linux is not Unix, but it is a Unix-like operating system. Linux system is derived from Unix and it is a continuation of the basis of Unix design. Linux distributions are the most famous and healthiest example of the direct Unix derivatives. BSD (Berkley Software Distribution) is also an example of a Unix derivative.

What is the difference between Telnet and SSH?

The key difference between Telnet and SSH is that SSH uses encryption, which means that all data transmitted over a network is secure from eavesdropping.

Explain the three load averages and what do they indicate. What command can be used to view the load averages?

Load average – is the average system load calculated over a given period of time of 1, 5 and 15 minutes.

4cat /proc/loadavg

Can you name a lower-case letter that is not a valid option for GNU ls?

1option 'y'
2option 'z'

What is a Linux kernel module?

Kernel modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system.

Walk me through the steps in booting into single user mode to troubleshoot a problem.

It is runlevel 1 under system SysV init (telinit 1), and or in systemd.

GRUB => 'e' => rw init=/sysroot/bin/sh => 'Ctrl-X' => chroot /sysroot/

Walk me through the steps you'd take to troubleshoot a 404 error on a web application you administer.

  • check files location
  • check files permissions
  • check server free space
  • check web-server service
  • logs
  • etc...

What is ICMP protocol? Why do you need to use?

ICMP is a protocol for sending various messages to report network conditions. ICMP is used by a device, like a router, to communicate with the source of a data packet about transmission issues. For example, if a datagram is not delivered, ICMP might report this back to the host with details to help discern where the transmission went wrong. It's a protocol that believes in direct communication in the workplace.

Ping is a utility which uses ICMP messages to report back information on network connectivity and the speed of data relay between a host and a destination computer. It's one of the few instances where a user can interact directly with ICMP, which typically only functions to allow networked computers to communicate with one another automatically.