2019 Common Linux interview questions and answers to resolve, what you will not?

Linux interview questions

1, the absolute path is shown with what symbols? The current directory, parent directory is represented by what? Home directory is represented by what? Change directory what order?
2, how to view the current process? How an exit? How to view the current path?
3, how clear the screen? How to exit the current command? How to perform sleep? How to view the current user id? View help specify what order?
4, Ls command performs what function? Which parameter can take, what's the difference?
5, the soft links (shortcuts), and hard links command.
6, create a directory what order? Create a file what order? Copy the file what order?
7, view the contents of the file have what command?
8, free to write file commands? How the string with spaces to the screen output, such as "helloworld"?
9, which end is which file folder? Black hole which command file which folder?
10, which move the file command? Which changed its name to command?
11, which command to copy files? If you need to copy a folder along with it? If you need prompts it?
12, delete the file which command? If you need even directories and directory delete a file it? Delete empty folders what order?
13, Linux command, which has several wildcards that can be used? What do they all mean?
14, what order the contents of a file of statistics? (Row number, number of words, number of bytes)
15, Grep command what is the use? How to ignore case? How to find free line of the string?
16, Linux in the process, which has several state? Ps displayed in the message, respectively, what notation?
17, how to make a command to run in the background?
18, use ps how to display all the processes? Ps to see how the use of the specified process information?
19, which commands designed to view the background tasks?
20, the background to the foreground task performed using what order? Background task to stop what order to implement in the background?
21, to terminate the process what order? With what parameters?
22, to see how the system supports all the signals?
23, search for files what order? Format is kind of how?
24, to see who is currently in use by the host what order? Find information terminal where their what order?
25, used what command to view a list of commands?
26, what command to view disk usage? Free space?
27, what command to see if network connectivity?
28, use the command to see what ip address and interface information?
29, see the various types of environmental variables what order?
30, by what command specifies the command prompt?
31, the Find command executable file is going to find? How to set it up and add?
32, look for what execute commands via the command?
33, how to command alias?
34, the definition of du and df, and the difference?
35, awk explain.
36, when you need to bind a command or macro keys, how should I do it?
37, wants to know if a linux newbie list of all currently commands supported by the system, how he needs to do?
38, if you want to print out the current assistant to the directory stack, how would you advise him to do?
39, your system There are many tasks that are running, restart the machine without conditions, is there any way you can put all the running processes to remove it?
40, bash shell hash command in what role?
41, which can be a built-in command bash mathematical operations.
42, page by page, how to view the contents of a large file it?
43, a data dictionary belongs to which user?
44, how to view a summary of the usage of a linux command? Suppose you happened to see a command you've never seen before in the / bin directory, how do you know its role and usage of it?
45, which one command to view the disk space quota own file system?


Linux analytical answer interview questions

1, the absolute path is shown with what symbols? The current directory, parent directory is represented by what? Home directory is represented by what? Change directory what order?

answer:
Absolute path: as /etc/init.d
The current directory and the parent directory: ./ ../
Home directory: ~ /
Change directory: cd

2, how to view the current process? How an exit? How to view the current path?

answer:
View the current process: ps
An exit: exit
View the current path: pwd

3, how clear the screen? How to exit the current command? How to perform sleep? How to view the current user id? View help specify what order?

answer:
Clear screen: clear
Exit the current command: ctrl + c to completely exit
Execution sleep: ctrl + z suspends the current process to restore the background fg
View the current user id: "id": View shows the current login account uid and gid and Group-owned and user name
View help specify: If this man adduser very wide and there are examples; adduser --help this tell you some common parameters; info adduesr;

4, Ls command performs what function? Which parameter can take, what's the difference?

answer:
ls functions performed: Lists the specified directory directory, and file
Which parameters and the difference between: a file all l details, including the size of the number of bytes, read-write and the like executable permissions

5, the soft links (shortcuts), and hard links command.

answer:
Soft link: ln -s slink source
Hard link: ln link source

6, create a directory what order? Create a file what order? Copy the file what order?

answer:
Create a directory: mkdir
Create a file: typical, such as touch, vi files can also be created, in fact, as long as the output to a file that does not exist, will create a file
Copying files: cp 7. file permissions to modify what order? Format is kind of how?
Modify the file permissions: chmod
Format is as follows:
Permissions chmodu + xfile to the owner of the file increases execute permissions chmod 751 file to the owner of the distribution file read, write, execute permissions (7), and to file the assignment read where the group performs (5), and to other users assigned permission to perform (1)
chmodu = rwx, g = rx, o = chmod xfile another form of the embodiment of = r file read permissions assigned to all users
chmod444file same example chmod a-wx, a + r file supra Example
$ Chmod -R u + r directory recursively assigned to the owner of all files and subdirectories under the directory read directory permissions

7, view the contents of the file have what command?

answer:
vi filename # editing view, modify
# cat file name show all file contents
more filename # page display file contents
less filename # and more similar, better can flip forward
tail filename # see only the tail, you can also specify the number of rows
head filename head # view only, you can also specify the number of rows

8, free to write file commands? How the string with spaces to the screen output, such as "hello world"?

answer:
Write File command: vi
String with spaces to the screen output: echo hello world

9, which end is which file folder? Black hole which command file which folder?

answer:
Terminal / dev / tty
Black Hole file / dev / null

10, which move the file command? Which changed its name to command?

answer:
mv mv

11, which command to copy files? If you need to copy a folder along with it? If you need prompts it?

answer:
cp cp -R ????

12, delete the file which command? If you need even directories and directory delete a file it? Delete empty folders what order?

answer:
rm rm -r rmdir

13, Linux command, which has several wildcards that can be used? What do they all mean?

answer:
"?" Can replace a single character.
"*" To replace any number of characters.
Square brackets "[charset]" Alternatively charset any single character set, such as [az], [abABC]

14, what order the contents of a file of statistics? (Row number, number of words, number of bytes)

answer:
wc command - c statistics bytes - l counts the number of lines - w word count.

15, Grep command what is the use? How to ignore case? How to find free line of the string?

answer:
Is a powerful text search tool, you can use a regular expression search text, and print out the matching rows.
grep [stringSTRING] filename grep [^string] filename

16, Linux in the process, which has several state? Ps displayed in the message, respectively, what notation?

answer:
(1) not interrupt status: The process is sleeping, but at the moment the process is not interrupted. Can not be interrupted, refers to the process does not respond to asynchronous signals.
(2) suspend state / status tracking: transmitting a signal SIGSTOP process, it will be due to response to the signal state into TASK_STOPPED; when the process is being tracked, it is in this particular state TASK_TRACED. Being tracked "refers to the process pauses, waiting for tracking its process to operate it.
(3) ready state: the state of the queue run_queue
(4) the operating state: in the state of the queue run_queue
(5) can interrupt sleep: in this state because the process waiting to happen certain events (such as waiting for socket connection, waiting for the semaphore), and is suspended
(6) zombie state (zombie): The father did not wait by the way, the series of system call the corpse of the child process (task_struct) also freed
(7) exit status
D uninterruptible Uninterruptible (usually IO)
R is running or in the queue process
S dormant state
T stopped or track
Z zombie process
W into the memory swap (invalid from the beginning of a kernel 2.6)
X dead process

17, how to make a command to run in the background?

answer:
& Generally used at the end of the command to let the program run automatically. (Command can not append blanks)

18, use ps how to display all the processes? Ps to see how the use of the specified process information?

answer:
ps -ef (system v 输出)
ps -aux bsd 格式输出
ps -ef | grep pid复制代码

19, which commands designed to view the background tasks?

answer:
job -l

20, the background to the foreground task performed using what order? Background task to stop what order to implement in the background?

answer:
The background to the foreground task execution fg
To stop the background task in the background up bg

21, to terminate the process what order? With what parameters?

answer:
kill [-s <message name or number>] [Program] or kill [-l <message number>]
kill-9 pid

22, to see how the system supports all the signals?

answer:
kill -l

23, search for files what order? Format is kind of how?

answer:
find <specified directory> <specified condition> <action specified>
whereis file name plus parameters
locate an increase of only file names
find direct search disk, slower.
find / -name "string*"

24, to see who is currently in use by the host what order? Find information terminal where their what order?

answer:
Find where their terminal information: who am i
See who's currently in use that host: who

25, used what command to view a list of commands?

answer:
history

26, what command to view disk usage? Free space?

answer:
df -hl复制代码
File system capacity has been available with a mount point%
Filesystem Size Used Avail Use% Mounted on /dev/hda2 45G 19G 24G
44% /
/dev/hda1 494M 19M 450M 4% /boot复制代码

27, what command to see if network connectivity?

answer:
netstat

28, use the command to see what ip address and interface information?

answer:
ifconfig

29, see the various types of environmental variables what order?

answer:
View all env
View a like home: env $ HOME

30, by what command specifies the command prompt?

answer:
\ U: Displays the current user account
\ H: Displays the current hostname
\ W: only displays the current directory path to the final
\ W: Displays the current absolute path (current user directory will be replaced by ~)
$ PWD: Displays the current full path
$: Display the command line '$' or '#' symbol
#: The first few commands issued
\ D: represents the date, month date format is week day, for example: "MonAug1"
\ T: time of 24 hours display format, such as: HH: MM: SS
\ T: 12-hour time display format
\ A: display time for the 24-hour format: HH: MM
\ V: BASH version information such as export PS1 = '[\ u @ \ h \ w #] $'

31, the Find command executable file is going to find? How to set it up and add?

answer:
whereis [-bfmsu] [- B <directory> ...] [- M <directory> ...] [- S <directory> ...] [... File]
Supplement: whereis command will find qualified files in a specific directory. Spirits of those documents should belong to the original code, binary files, or help file.
-b find only binary files.
-B <directory> find only binary files in the directory settings. -f path name is not displayed before the file name.
-m only to find documentation.
Find documentation in the directory set -M <catalog> only. -s only to find the original code files.
-S <Directory> only to find the original code files in the directory settings. Find -u does not contain the specified type of file.
w -h ich instruction specified in the PATH variable path, searches the position of a system command, and returns a search result first.
-n specify a file name length, must be specified length equal to or greater than the longest of all the file name of the file.
-p and -n parameters the same, but here include the path to the file. -w Specifies the width of the output field.
-V Display version information

32, look for what execute commands via the command?

answer:
which can only check the executable file
whereis only check the binaries, documentation, source files, etc.

33, how to command alias?

answer:
alias la='ls -a'复制代码

34, the definition of du and df, and the difference?

answer:
du displays the size of a file or directory
df displays information for each file system <file> where the default is to display all file systems. (Some of the file system disk blocks allocated to its own record some data, such as node i, disk profile, indirect blocks, super blocks, etc. These data most user-level programs is not visible, usually called Meta Data.) du command is a user-level programs, it does not consider Meta Data, and df command to view the file system disk allocation map and consider the Meta Data.
df command to get real file system data, and the du command to see only part of the case file system.

35, awk explain.

answer:
awk '{pattern + action}' {
	filenames
}
#cat /etc/passwd |awk -F ':' '{print 1"t"7}' //-F 的意思是以':'分隔 root
/bin/bash
daemon /bin/sh 搜索/etc/passwd 有 root 关键字的所有行
#awk -F: '/root/' /etc/passwd root:x:0:0:root:/root:/bin/bash复制代码

36, when you need to bind a command or macro keys, how should I do it?

answer:
Command can bind, bind binding can easily implement the macro keys or in the shell. When making key bindings, we need to get to the binding character sequence corresponding to the button.
Acquiring a sequence of characters such as F12 acquiring follows: first press Ctrl + V, and then press the F12 we can get the character sequence F12 ^ [[24 ~.
Then use bind bind.
[root@localhost ~]# bind ‘”e[24~":"date"'复制代码
Note: The same key may generate a different sequence of characters at different terminals or terminal emulator.
[Annex] showkey -a command may be used to view a sequence of characters corresponding to the key.

37, wants to know if a linux newbie list of all currently commands supported by the system, how he needs to do?

answer:
Use the command compgen -c, you can print a list of all the supported command.
[root@localhost ~]$ compgen -c
l.
ll
ls
which
if
then else
elif
fi
case
esac
for
select
while
until
do
done复制代码

38, if you want to print out the current assistant to the directory stack, how would you advise him to do?

answer:
Use Linux command dirs current directory stack can be printed out.
[root@localhost ~]# dirs
/usr/share/X11复制代码
[Annex]: directory stack operated by pushd popd.

39, your system There are many tasks that are running, restart the machine without conditions, is there any way you can put all the running processes to remove it?

answer:
Use the linux command 'disown -r' all running processes can be removed.

40, bash shell hash command in what role?

answer:
linux command 'hash' management with a built-in hash table records the full path of the command has been executed, can use this command to print out the commands you've used and the number of executions.
[root@localhost ~]# hash
hits command
2 /bin/ls
2 /bin/su复制代码

41, which can be a built-in command bash mathematical operations.

answer:
bash shell built-in commands let you can perform mathematical operations of an integer.
#! /bin/bash
…
…
let c=a+b
…
…复制代码

42, page by page, how to view the contents of a large file it?

answer:
Pipe the command "cat file_name.txt" and 'more' can be joined together to achieve this need.
[root@localhost ~]# cat file_name.txt | more复制代码

43, a data dictionary belongs to which user?

answer:
Dictionary data belongs 'SYS' user, the user 'SYS' and 'SYSEM' is automatically created by the system default

44, how to view a summary of the usage of a linux command? Suppose you happened to see a command you've never seen before in the / bin directory, how do you know its role and usage of it?

answer:
You can use the command whatis first-out show brief usage of this command, for example, you can use whatiszcat go see 'zcat' brief introduction and use.
[root@localhost ~]# whatis zcat
zcat [gzip] (1) – compress or expand files复制代码

45, which one command to view the disk space quota own file system?

answer:
Use the command repquota able to show quota information for a file system
[Attached] only the root user can view other user's quota.




At last

Welcome to share with everyone, welcome to my public concern number [programmers] Herd, 2019 companies java face questions compiled over 1000 Road 400-page pdf document, the article will be updated on the inside, finishing materials will put inside.

Article I remember like the point of a concern like yo, thanks for the support!


Guess you like

Origin juejin.im/post/5e05c523f265da33b201d9e5