Top 20 Linux practical questions asked in interview-2023

  1. How do you find all files with a specific extension in a directory?
find /path/to/directory -name "*.extension"
  1. How do you find the size of a file or directory?
du -sh /path/to/file_or_directory
  1. How do you display the contents of a file in the terminal?
cat /path/to/file
  1. How do you search for a string in a file?
grep "string" /path/to/file
  1. How do you copy a file from one directory to another?
cp /path/to/source_file /path/to/destination_directory
  1. How do you rename a file or directory?
mv /path/to/old_name /path/to/new_name
  1. How do you create a new user account?
adduser username
  1. How do you change file or directory permissions?
chmod permissions /path/to/file_or_directory
  1. How do you compress or decompress a file or directory?
tar -czvf archive.tar.gz /path/to/directory # Compress
tar -xzvf archive.tar.gz # Decompress
  1. How do you kill a process?
kill process_id
  1. How do you list all installed packages?
dpkg --list
  1. How do you update all installed packages?
apt-get update && apt-get upgrade
  1. How do you install a package?
apt-get install package_name
  1. How do you uninstall a package?
apt-get remove package_name
  1. How do you check the system load?
uptime
  1. How do you check system resources (CPU, memory, etc.) usage?
top
  1. How do you display the contents of a compressed file without decompressing it?
zcat /path/to/file.gz | less
  1. How do you check the available disk space on a partition?
df -h
  1. How do you monitor log files in real-time?
tail -f /var/log/file.log
  1. How do you display the network configuration of the system?
ifconfig

These are just some examples of practical Linux interview questions and their corresponding code snippets. Depending on the position and company, the questions may vary in difficulty and scope.

Leave a Reply

Your email address will not be published. Required fields are marked *