Organize 20 Linux Command interview questions

Source: Internet
Author: User
Tags diff

20 Linux Command interview questions and answers below:

Q: 1 How do I see the running level of the current 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 to view the Linux default gateway?

A: With the "Route-n" and "NETSTAT-NR" commands, we can view the default gateway. In addition to the default gateway information, the two commands can also display the current routing table.

   Q: 3 How to rebuild the initialization 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 particular kernel version, you replace ' uname-r ' with the desired kernel name.

In CentOS 6.x/rhel 6.X, the initialization memory disk file is created with the Dracut command, for example:

# dracut-f

The above command creates an initialization memory disk for the current system version, and rebuilds the initialization memory disk file for a specific kernel version using 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?

A: 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 to use?

A: As the name suggests, the patch command is used to write changes (or patches) into a text file. The patch command usually receives the output of diff and converts the old version of the file to a new version. For example, the Linux kernel source code is made up of millions of lines of code files, so whenever any code contributor contributes to the code, it simply sends the changed part instead of the entire source code, and the receiver uses the patch command to write the changes into the original source.

Create a diff file for patch to use,

# Diff-naur Old_file new_file > Diff_file

Old and new files are either individual files or directories containing files, the-R parameter supports tree recursion.

Once the diff file is created, we can patch it up on 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 suggests, Aspell is an interactive spelling checker on the Linux operating system. The Aspell command succeeded an earlier program called Ispell, and as a free substitute, the most important thing was that it was very useful. When the Aspell program is used primarily by other programs that require spell checking, it can be very effective as a stand-alone tool on the command line.

   Q: 7 How do I view the domain SPF record from the command line?

A: We can use the dig command to view the domain SPF record. Examples are as follows:

linuxtechi@localhost:~$ dig-t TXT google.com

   Q: 8 How to identify the associated packages for a specified file (/etc/fstab) in a Linux system?

For:

# Rpm-qf/etc/fstab

The above command lists the packages that provide the "/etc/fstab" file.

   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 Linux system?

A: the/proc file system is a memory-based file system that maintains information about the currently running kernel state, including CPU, memory, partition, I/O addresses, direct memory access channels, and running processes. This file system does not represent a variety of files that actually store information, they point to information in memory. The/proc file system is automatically maintained by the system.

   Q: 11 How to find files with a size exceeding 10MB in the/usr directory?

For:

# find/usr-size +10m

   Q: 12 How to find the files that were modified 120 days ago in the/home directory?

For:

# Find/home-mtime +120

   Q: 13 How to find files in the/var directory that have not been accessed within 90 days?

For:

# Find/var \! -atime-90

   Q: 14 Find the file "core" under the entire directory tree, and if found, do not need to be prompted to delete them directly.

For:

# Find/-name core-exec rm {} \;

   Q: What is the effect of the strings command?

A: The strings command is used to extract and display text strings in a non-text file. (LCTT: When used to analyze a inexplicably binary program on your system, you can find suspicious file access, which is useful for tracing intrusions)

   Q: What is the effect of tee filter?

A: Tee filters are used to send output to multiple destinations. If used for pipelines, it can copy the output to one file and copy another to the screen (or some other program).

linuxtechi@localhost:~$ 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 = "$LOGNAME @hostname:\ $PWD: What is this order doing?

A: This export command changes the login prompt to display the user name, local name, and current working directory.

   Q: ll | awk ' {print $, ' owns ', $} ' what is this command doing?

A: This ll command will display the file names of these files 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 perform a one-time execution in the future. All submitted tasks are placed under the/var/spool/at directory and are executed through 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 add-on devices on your system. Specify-V,-VV or-VVV to obtain more and more detailed output, plus the-r parameter, the output of the command will be more readable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.