1. What is the symbol for absolute paths? What are the current and upper directories represented by? What is the home directory? What command is used to switch directories?

Absolute path: for example, /etc/init.d

Current and upper directories:./.. /

Home directory: ~/

Switch directory: CD

2. How to check the current process? How do I exit? How do I view the current path?

View the current process: ps

Run exit

View the current path: PWD

3. How to clear the screen? How do I exit the current command? How to perform sleep? How do I view the current user ID? What command is used to view specified help?

CLS: clear
Exit the current command: CTRL + C exits completely
Execute sleep: CTRL + Z suspends the current process FG to restore background
View the current user ID: “ID” : Displays the UID, GID, group, and user name of the current logged-in account
Look for specific help: for example, man adduser, which is full and has examples; Adduser –help tells you some common arguments; The info adduesr;

4. What function does the Ls command perform? What parameters can be taken and what is the difference?

Ls lists directories and files in a specified directory
A All files l Detailed information, including size, number of bytes, read, write and execute permissions, etc

5, establish soft link (shortcut), and hard link command.

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

What command is used to create a directory? What command is used to create a file? What command is used to copy files?

Create a directory: mkdir
Create a file: Typically touch, vi can also create a file, in fact, any output to a file that does not exist, will create a file
7. What command is used to modify file permissions? What’s the format?
File permission modification: chmod
The format is as follows:
Grant execute permission to the owner of file chmod 751 file Grant read, write, and execute permission to the owner of File and read and execute permission to the group where file resides. Assign permissions to other users to perform (1) chmodu= RWX,g=rx,o=xfile Another form of the example above chmod =r file assigns read permissions to all users
Chmod444file The same as the preceding example. Chmod A-wx,a+ R file The same as the preceding example
$chmod -r u+ R directory Assigns read permissions to the owners of all files and subdirectories in directory recursively

7. What commands can be used to view file contents?

Vi file name # edit mode view, can be modified
Cat file name # Displays all file contents
More file name # Display file contents in pages
Less file name # is similar to more, but better yet, you can scroll forward
Tail file name # Only look at the tail, you can also specify the number of lines
Head file name # View only the header and can also specify the number of lines


8. Write files at will? How do I output a string with a space to the screen, such as “Hello world”?

Write file command: vi
Prints a string with a space to the screen :echo hello world


9. Which file is the terminal under which folder? Which command in which folder is the black hole file?

The terminal/dev/tty
The black hole file /dev/null

Which command is used to move files? Which command should I use for the name change?

mv mv

Which command is used to copy files? What if you need to copy along with the folder? What if you need a hint function?

Cp cp -r ????

Which command is used to delete files? What if you need to delete both the directory and the files in the directory? What command is used to delete an empty folder?

rm rm -r rmdir

13. What kinds of wildcards can be used in Linux commands? What do they mean?

“?” Can replace a single character.
* can replace any number of characters.
Square brackets “[charset]” can replace any single character in the charset, such as [a-z], [abABC].

What command is used to make statistics on the contents of a file? (Line number, word number, byte number)

The wc command -c counts the number of bytes -l The number of lines -w The number of words.

15. What is the use of Grep command? How do I ignore case? How do I find a row that does not contain this string?

Is a powerful text search tool that uses regular expressions to search text and print matching lines.
grep [stringSTRING] filename grep [^string] filename

What are the states of processes in Linux? What symbols are used to represent the information displayed in PS?

1. Non-interruptible: The process is sleeping, but at this point it is not interruptible. Non-interruptible, meaning that the process does not respond to asynchronous signals.
2. Pause/trace state: send a SIGSTOP signal to the process and it will enter the TASK_STOPPED state in response to that signal; When a process is being traced, it is in a special state called TASK_TRACED.
“Being traced” means that the process has paused and is waiting for the tracing process to act on it.
Ready state: the state of the run_queue
4. Running status: the status of the run_queue
5. Interruptible sleep: the process in this state is suspended because it is waiting for something to happen (such as waiting for a socket connection, waiting for a semaphore)
Zombie state: A task_struct is released when the parent fails to pass the wait system call
7. Exit the state
  • D Uninterruptible (usually IO)
  • R Is running, or a process in a queue
  • S is in the sleep state
  • T stops or is tracked
  • Z Zombie process
  • W into memory swap (invalid from kernel 2.6)
  • X dead process

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

The ampersand is usually used at the end of the command to make the program run automatically. (No space can be added after the command.)

18. How to display all processes in PHOTOSHOP? How to use PS to view information about a given process?

Ps - ef (system v output) ps - aux BSD format output ps - ef | grep pidCopy the code

19. Which command is used to view background tasks?

job -l 

20. What command is used to move background tasks to the foreground? What command is used to execute a stopped background task in the background?

Move the background task to the foreground to execute fg
Start a stopped background task in the background bg

21. What command is used to terminate the process? What parameters does it take?

Kill [-s < message name or number >][program] or kill [-l < message number >]
kill-9 pid 

22. How to view all signals supported by the system?

kill -l

What command is used to search for files? What’s the format?

Find < specify directory > < specify condition > < specify action >
Whereis takes a parameter and file name
Locate simply adds the file name
Find Searches for disks slowly.
find / -name “string*”

What command is used to check who is currently using this host? What command is used to find information about the terminal where you reside?

Query information about the terminal where you reside: who am I
View who is currently using the host: who

25. What command is used to view the used command list?

history

26. What command is used to check the disk space? What about free space?

df -hlCopy the code

File system capacity used Available Used % Mount point

Filesystem Size Used Avail Use% Mounted on /dev/hda2 45G 19G 24G
44% /
/dev/hda1 494M 19M 450M 4% /bootCopy the code

27. What command is used to check whether the network is connected?

netstat

28. What command is used to view the IP address and interface information?

ifconfig

What command is used to view various environment variables?

View all env
To view something, such as home: env $HOME

30. What command is used to specify the command prompt?

  • \u: Displays the current user account
  • \h: Displays the current host name
  • \W: displays only the last directory of the current path
  • \w: Displays the current absolute path (the current user directory will be replaced by ~)
  • $PWD: displays the current full path
  • $: Displays command line ‘$’ or’ #’ symbols
  • # : Number of orders issued
  • \ D: indicates the date in the format of week day month Date, for example: “MonAug1”
  • \ T: Display time in 24-hour format, such as HH: MM: SS
  • \T: Display time in 12-hour format
  • \A: Display time in 24-hour format: HH: MM
  • \v: BASH version information such as export PS1= ‘[\u@\h\w#]$’

Where do I find the executable files for the find command? How to set and add it?

Whereis [-bfmsu][-b < directory >… [-m < directory >…] [-s < directory >…] [file]…

A sidebar: The whereis directive looks for qualifying files in a specific directory. The strength of these files should be raw code, binaries, or help files.
  • -b Searches only binary files.
  • -b < directory > only looks for binaries in the directory you set. -f Does not display the path name before the file name.
  • -m Searches only description files.
  • -m < directory > looks for description files only in the directory you set. -s finds only the original code file.
  • -s < directory > only looks for raw code files in the directory you set. -u Searches for files that do not contain the specified type. The W-h ICH command searches for a system command in the PATH specified by the PATH variable and returns the first search result.
  • -n Specifies the length of the file name. The specified length must be longer than or equal to the longest file name in all files.
  • The -p parameter is the same as the -n parameter, but contains the file path. -w Specifies the width of the output field.
  • -v Displays the version information

32. What command is used to find the execution command?

Which can only look up executable files
Whereis can only look up binary files, documentation, source files, etc

33. How do I alias a command?

alias la='ls -a'Copy the code

34, What are the differences between du and DF?

Du displays the size of directories or files
Df displays information about the file system in which each < file > resides. By default, all file systems are displayed.
The file system allocates some of these disk blocks to record its own data, such as i-nodes, disk maps, indirect blocks, superblocks, etc. This Data is not visible to most user-level programs and is often referred to as Meta Data. The du command is a user-level program that does not consider Meta Data, while the df command looks at the disk allocation graph of the file system and considers Meta Data.
The df command gets the real file system data, while the du command only looks at part of the file system.

Awk details.

awk '{pattern + action}' {filenames}
# cat/etc/passwd | awk -f ':' '1 "\ t" 7} {print' / / - F separate root meaning is' : '/bin/bash daemon /bin/sh Searches for all lines in /etc/passwd that contain the root keyword#awk -F: '/root/' /etc/passwd root:x:0:0:root:/root:/bin/bash Copy the code

36. What do you do when you need to bind a macro or key to a command?

You can use the bind command, which makes it easy to bind macros or keys in the shell.
When performing key binding, we need to obtain the character sequence corresponding to the binding key first.
For example, to obtain the character sequence of F12, press Ctrl+V first, then F12. We get the sequence of F12 ^[[24~.
Then use bind to bind.

[root@localhost ~]# bind '" \ [24 ~ e ":" date"Copy the code
Note: The same keystroke may produce different character sequences on different terminals or terminal emulators.

You can also use the showkey -a command to view the character sequence corresponding to the key.

37. What would a Linux newbie do if he wanted to know a list of all the commands currently supported by the system?

Using the compgen -c command, you can print a list of all supported commands.

[root@localhost ~]$ compgen -c
l.
ll
ls
which
if
then
else
elif
fi
case 
esac
for
select
while
until
do
doneCopy the code

38, If your assistant wanted to print out the current directory stack, what would you advise him to do?

The current directory stack can be printed using the Linux command dirs.

[root@localhost ~]# dirs
/usr/share/X11 Copy the code

The directory stack is operated by pusHD popd.

39. There are many running tasks on your system. Is there any way to remove all running processes without restarting the machine?

Use the Linux command ‘disown -r’ to remove all running processes.

What does the hash command in bash shell do?

The Linux command ‘hash’ manages a built-in hash table that records the full path of executed commands and prints out the commands you have used and how many times they were executed.

[root@localhost ~]# hash
hits command
2 /bin/ls
2 /bin/su Copy the code

41. Which of the bash built-in commands can perform mathematical operations?

The bash shell’s built-in command let performs the math of integer numbers.

#! /bin/bash...letC = a + b...Copy the code

How to view the contents of a large file page by page?

This can be done by piping the command “cat file_name.txt” to ‘more’

[root@localhost ~]# cat file_name.txt | more Copy the code

43, Which user does the data dictionary belong to?

The data dictionary belongs to user ‘SYS’. Users’ SYS ‘and’ SYSEM ‘are automatically created by the system by default

44, How to view a Linux command summary and usage? Suppose you come across a command you’ve never seen before in the /bin directory. How do you know what it does and how to use it?

Using the whatis command, you can first display a summary of the command’s usage. For example, you can use whatiszcat to see the description of ‘zcat’ and the summary of its use.

[root@localhost ~]# whatis zcat Zcat [gzip] (1) - compress or expand filesCopy the code

45. Which command can be used to check the disk space quota of your file system?

The repquota command displays quota information for a file system
Only the root user can view the quota of other users.

Conclusion:

【 Preparation for Spring Recruitment series 】 Over the years about MySQL high frequency interview questions

【 Spring Recruitment series 】springBoot soul 22 ask!

【 Prepare for spring recruitment series 】50 micro service interview questions in detail

【 Prepare for spring recruitment series 】27 MyBatis interview real questions detailed explanation

Q: How do you nail an interviewer

Spring recruitment is coming, sorted out some classic interview questions often tested by big factory, friends in need can pay attention to wechat public number: Java Programmers gathering place.