0% found this document useful (0 votes)
20 views8 pages

Linux Questions

The document provides a comprehensive overview of Linux, covering its definition, components, and various commands used for system management. Key topics include the Linux kernel, file permissions, process management, and networking commands. It also explains concepts like symbolic links, package managers, and system logs, making it a valuable resource for understanding Linux operations.

Uploaded by

abu2thahir3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views8 pages

Linux Questions

The document provides a comprehensive overview of Linux, covering its definition, components, and various commands used for system management. Key topics include the Linux kernel, file permissions, process management, and networking commands. It also explains concepts like symbolic links, package managers, and system logs, making it a valuable resource for understanding Linux operations.

Uploaded by

abu2thahir3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1. What is Linux?

Answer: Linux is an open-source, Unix-like operating system kernel that


powers a wide range of devices and systems, including servers, desktops, and
embedded systems.

2. What is the Linux kernel?

Answer: The Linux kernel is the core part of the Linux operating system,
responsible for managing system resources, hardware communication, and
enforcing security.

3. What are the main components of a Linux system?

Answer: The main components are the Linux kernel, system libraries, system
utilities, shell, and user applications.

4. What is a shell in Linux?

Answer: A shell is a command-line interface that interprets and executes user


commands. Common shells include bash, zsh, and sh.

5. What is the difference between a command and a process?

Answer: A command is an instruction given to the shell, while a process is an


instance of a program in execution that consumes system resources like CPU
and memory.

6. How do you check the current working directory in Linux?

Answer: Use the pwd (print working directory) command.

7. How can you list all files and directories in Linux?

Answer: Use the ls command. To list hidden files, use ls -a.

8. How do you change directories in Linux?


Answer: Use the cd command followed by the directory path, e.g., cd
/home/user.

9. What is a file permission in Linux?

Answer: File permissions in Linux determine who can read, write, or execute a
file. They are assigned to the owner, group, and others.

10. How do you change file permissions in Linux?

Answer: Use the chmod command, followed by permission settings and the file
name, e.g., chmod 755 filename.

11. What is the difference between su and sudo?

Answer: su (substitute user) switches to another user account, typically root,


whereas sudo allows users to execute a command with root privileges without
switching accounts.

12. How do you view the contents of a file in Linux?

Answer: Use commands like cat, more, less, head, or tail to view file contents.

13. What is a symbolic link in Linux?

Answer: A symbolic link (symlink) is a reference to another file or directory.


Use ln -s to create a symbolic link.

14. What is the purpose of the grep command?

Answer: grep is used to search text or files for specific patterns. For example,
grep "word" filename searches for "word" in the specified file.

15. What is the ps command used for?

Answer: The ps command displays information about active processes,


including their process ID (PID), user, and resource usage.

16. How do you terminate a process in Linux?


Answer: Use the kill command followed by the PID of the process. For
example, kill 1234. For forceful termination, use kill -9 PID.

17. What are runlevels in Linux?

Answer: Runlevels are different modes of operation in Linux that define the
state of the machine, such as multi-user, single-user, and graphical modes.
Modern systems use systemd targets instead.

18. What does the df command do?

Answer: The df command reports disk space usage of mounted filesystems,


showing available and used space.

19. How do you check memory usage in Linux?

Answer: Use the free command to display memory usage, including total, used,
and available memory.

20. What is the top command used for?

Answer: top displays real-time information about system processes, including


CPU and memory usage.

21. How do you create a new file in Linux?

Answer: You can create a new file using commands like touch filename or
using redirection, e.g., echo "text" > newfile.txt.

22. What is the chmod command used for?

Answer: chmod changes file or directory permissions in Linux. For example,


chmod 755 filename sets specific read, write, and execute permissions.

23. How do you check network connectivity in Linux?

Answer: Use the ping command followed by a hostname or IP address to check


network connectivity, e.g., ping google.com.
24. What is the ifconfig command used for?

Answer: ifconfig is used to configure or display the network interfaces on Linux


systems. It’s being replaced by ip commands in modern systems.

25. How do you search for a file in Linux?

Answer: Use the find command to search for files. For example, find /home -
name "file.txt" searches for file.txt in the /home directory.

26. What is a package manager in Linux?

Answer: A package manager simplifies the installation, upgrading, and removal


of software packages. Examples include apt (Debian/Ubuntu) and yum or dnf
(RHEL/CentOS).

27. What is the difference between hard links and soft links?

Answer: Hard links are direct pointers to file data, and deleting one link does
not affect others. Soft links (symbolic links) are references to another file’s
path.

28. What does the crontab command do?

Answer: crontab is used to schedule tasks to run at specified intervals. For


example, crontab -e opens the cron jobs editor.

29. What is sudo and why is it important?

Answer: sudo allows a permitted user to execute a command as the superuser or


another user, providing controlled privilege escalation.

30. How do you view the system logs in Linux?

Answer: System logs are typically stored in /var/log. You can view logs using
commands like cat, less, or tail. For example, tail -f /var/log/syslog.

31. What is the purpose of the mv command?


Answer: The mv command is used to move or rename files and directories in
Linux. For example, mv file1.txt /home/user moves file1.txt to the /home/user
directory.

32. What is the cp command used for?

Answer: The cp command copies files or directories from one location to


another. For example, cp file1.txt /home/user copies file1.txt to the /home/user
directory.

33. What does the rm command do?

Answer: The rm command is used to delete files or directories. To delete a


directory and its contents recursively, use rm -r directory.

34. What is the difference between > and >> in Linux?

Answer: > overwrites a file with new content, while >> appends new content to
the end of an existing file.

35. What is the /etc/passwd file?

Answer: The /etc/passwd file stores user account information, including the
username, UID, GID, home directory, and shell.

36. How do you add a new user in Linux?

Answer: Use the useradd command to create a new user. For example, sudo
useradd username creates a user, and passwd username sets the user’s password.

37. What is the /etc/shadow file?

Answer: The /etc/shadow file stores encrypted user password information and
related password policies, such as expiration dates.

38. What does the chmod 777 command mean?


Answer: The chmod 777 command sets read, write, and execute permissions for
the owner, group, and others on a file or directory. This gives everyone full
access.

39. What is the use of the chown command?

Answer: The chown command changes the ownership of files and directories.
For example, chown user:group filename changes the owner and group of the
file.

40. What is a daemon in Linux?

Answer: A daemon is a background process that runs continuously, typically


started at boot, and performs system-related tasks. Examples include httpd (web
server) and sshd (SSH server).

41. What is swap space in Linux?

Answer: Swap space is a portion of the hard drive used as virtual memory when
the physical RAM is full. It helps in preventing system crashes when memory
runs out.

42. How do you create a swap file in Linux?

Answer: To create swap space:

Create a file: sudo fallocate -l 1G /swapfile

Set permissions: sudo chmod 600 /swapfile

Set as swap: sudo mkswap /swapfile

Enable: sudo swapon /swapfile

43. What does the df -h command do?

Answer: The df -h command displays the disk usage of file systems in a human-
readable format (e.g., MB, GB).
44. What does the du command do?

Answer: The du (disk usage) command shows the disk space used by files and
directories. For example, du -sh /home/user shows the total size of the
/home/user directory.

45. What is the tar command used for?

Answer: The tar command is used to archive multiple files into a single file
(with the .tar extension) and optionally compress it (using gzip or bzip2). For
example, tar -czvf archive.tar.gz /directory creates a compressed archive.

46. How do you extract a .tar.gz file in Linux?

Answer: Use the tar command with the -x option. For example, tar -xzvf
archive.tar.gz extracts the contents of the .tar.gz file.

47. What is SSH and how is it used?

Answer: SSH (Secure Shell) is a protocol used to securely log into remote
systems. Use ssh user@hostname to connect to a remote system.

48. What is the /etc/hosts file?

Answer: The /etc/hosts file maps hostnames to IP addresses, allowing local


name resolution. For example, adding 127.0.0.1 example.com maps
example.com to localhost.

49. What is the difference between hard and soft mounting in Linux?

Answer: In hard mounting, if the server is down, the client will keep trying until
the server is up. In soft mounting, the client will return an error if the server
doesn’t respond after a timeout.

50. How do you find the size of a directory in Linux?


Answer: Use the du command with the -sh option. For example, du -sh
/directory gives the size of the /directory.

You might also like