Q: 1 How do I check the current operating level of a Linux server?
A: The ' who-r ' and ' runlevel ' commands can be used to view the running level of the current Linux server.
Q: 2 How do I see the default gateway for Linux?
A: With the "Route-n" and "NETSTAT-NR" commands, we can view the default gateway. In addition to the default gateway information, these two commands can also display the current routing table.
Q: 3 How do I rebuild the memory disk image file on Linux?
A: In CentOS 5.x/rhel 5.X, you can use the MKINITRD command to create an initialization memory disk file, for example:
# mkinitrd-f-v/boot/initrd-$ (UNAME-R). IMG $ (UNAME-R)
If you want to create an initialization memory disk for a specific kernel version, you replace the ' uname-r ' with the desired kernel name.
In the CentOS 6.x/rhel 6.X, the Dracut command is used to create the initialization memory disk file, as shown in the following example:
# dracut-f
The above command can create an initialization memory disk for the current system version, and the initialization memory disk file for a specific kernel version will use the following command:
# dracut-f Initramfs-2.x.xx-xx.el6.x86_64.img 2.x.xx-xx.el6.x86_64
Q: What is the 4 cpio command?
Answer: Cpio is the meaning of copying and copying. Cpio can copy files, lists, and extract files from an archive file (or a single file).
Q: What is the 5 patch command? How do I use it?
A: As the name implies, a patch command is used to write changes (or patches) into a text file. The patch command usually receives the diff output and converts the old version of the file to the new version. For example, the Linux kernel source code consists of millions of lines of code, so whenever any code contributor contributes the code, it simply sends the changed part instead of the entire source code, and the recipient uses the patch command to write the changes into the original source.
Create a diff file for patch use,
# Diff-naur Old_file new_file > Diff_file
Both the old and new files are either individual files or directories that contain files, and the-R parameter supports directory tree recursion.
Once the diff file is created, we can patch the old file and turn it into a new file:
# Patch < Diff_file
Q: What is the use of 6 Aspell?
A: As the name implies, Aspell is an interactive spell checker on the Linux operating system. Aspell ordered an earlier program called Ispell, and as a free replacement, the most important thing was that it was very useful. When the Aspell program is used primarily by other programs that require spell-checking capabilities, it can be very effective on the command line as a standalone tool.
Q: 7 How do I view the domain SPF record from the command line?
Answer: We can use the dig command to view the domain SPF record. Examples are as follows:
[Email protected]:~$ dig-t TXT google.com
Q: 8 How do I identify the associated package for a specified file (/etc/fstab) in a Linux system?
For:
# Rpm-qf/etc/fstab
The above command can list the packages that provide the file "/etc/fstab".
Q: 9 which command is used to view the status of Bond0?
For:
Cat/proc/net/bonding/bond0
Q: What is the use of the/proc file system in the Linux system?
A: The/proc file system is a memory-based file system that maintains information about the kernel state that is currently running, including CPU, memory, partitioning, I/O addresses, direct memory access channels, and running processes. This file system represents not a variety of files that actually store information, they point to the information in memory. The/proc file system is automatically maintained by the system.
Q: 11 How do I find files larger than 10MB in the/usr directory?
For:
# find/usr-size +10m
Q: 12 How do I find files that were modified 120 days ago in the/home directory?
For:
# Find/home-mtime +120
Q: 13 How do I find files that have not been accessed within 90 days in the/var directory?
For:
# Find/var \! -atime-90
Q: 14 Look for the file "core" under the entire directory tree, if found, without prompting to delete them directly.
For:
# Find/-name core-exec rm {} \;
Q: What is the purpose of the strings command?
A: The strings command is used to extract and display text strings in non-text files. LCTT: When used to analyze a binary program that is inexplicably present on your system, you can find suspicious file access, which is useful for tracing the intrusion.
Q: What is the function of the tee filter?
Answer: The tee filter is used to send output to multiple destinations. If used for pipelines, it can copy the output to one file and copy the other to the screen (or some other program).
[Email protected]:~$ ll/etc | NL | Tee/tmp/ll.out
In the example above, the LL output can be captured in the/tmp/ll.out file and also displayed on the screen.
Q: Export PS1 = "[Email protected]:\ $PWD: What is this command doing?]
A: This export command changes the login prompt to display the user name, the native name, and the current working directory.
Q: LL | awk ' {print $, ' owns ', ' $9} ' what is this command doing?
A: This ll command will show the file names and their owners.
Q: What is the use of the AT command in 19:linux?
A: The AT command is used to schedule a program to be executed once in the future. All submitted tasks are placed in the/var/spool/at directory and executed by the ATD Daemon at the time of execution.
Q: What is the role of the LSPCI command in Linux?
A: The LSPCI command is used to display information about the PCI bus and additional devices on your system. Specifying-V,-VV or-VVV to obtain more and more detailed output, plus the-r parameter, will make the output of the command more readable.
Original: http://www.codeceo.com/article/20-linux-command-question.html
"Turn" 20 Linux command interview questions and answers