preface
Recently in view of the Internet company interview asked knowledge points, summed up the Java programmer interview involves most of the interview questions and answers to share with you, I hope to help you review before the interview and find a good job, but also save you on the Internet to search for information time to learn.
Content covers: Java, MyBatis, ZooKeeper, Dubbo, Elasticsearch, Memcached, Redis, MySQL, Spring, SpringBoot, SpringCloud, RabbitMQ, Kafka, Linux and other technology stacks.
Full version Java interview questions address: Java backend questions integration
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?
The answer:
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?
The answer:
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?
The answer:
CLS: clear
Exit the current command: CTRL + C exits completely
Execute sleep: CTRL + Z Suspend current process fg restore background view current user ID: “id” : view display current login account UID and GID and group and user name view specified help: such as man adduser this is very complete and there are 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?
The answer:
Ls lists directories in a specified directory and file parameters and their differences: a All files l Detailed information, including size, number of bytes, read, write, and execute permissions
5, establish soft link (shortcut), and hard link command.
The answer:
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?
The answer:
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 the permission to perform (1) to other users. Chmodu = RWX,g=rx,o=xfile Another form of the preceding example. Chmod =r file Assign read permission to all users -r u+ R directory Assigns read permissions to the owners of all files and subdirectories in the directory recursively
7. What commands can be used to view file contents?
The answer:
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”?
The answer:
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 answer:
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?
The answer:
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?
The answer:
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?
The answer:
rm rm -r rmdir
13. What kinds of wildcards can be used in Linux commands? What do they mean?
The answer:
“?” 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 answer:
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?
The answer:
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?
The answer:
(1) Non-interruptible state: The process is sleeping, but at this point the process 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 the 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 in run_queue
(4) Running status: the status of the run_queue
(5) Interruptable sleep state: the process in this state is suspended because it is waiting for something to happen (such as waiting for socket connection, waiting for semaphore)
Zombie state: A task_struct is released when the parent fails to pass the wait system call
W into memory swap (invalid from kernel 2.6)
X dead process
(7) Exit 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 answer:
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?
The answer:
Ps -EF (System V output)
The output is in Ps-aux BSD format
ps -ef | grep pid
19. Which command is used to view background tasks?
The answer:
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?
The answer:
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?
The answer:
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?
The answer:
kill -l
What command is used to search for files? What’s the format?
The answer:
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?
The answer:
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?
The answer:
history
26. What command is used to check the disk space? What about free space?
The answer:
df -hl
File system capacity used Available Used % Mount point
Filesystem Size Used Avail Use% Mounted on /dev/hda2 45G 19G 24G44% //dev/hda1 494M 19M 450M 4% /boot
27. What command is used to check whether the network is connected?
The answer:
netstat
28. What command is used to view the IP address and interface information?
The answer:
ifconfig
What command is used to view various environment variables?
The answer:
View all env
To view something, such as home: env $HOME
30. What command is used to specify the command prompt?
The answer:
\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 ‘: displays command line’ : displays command line ‘or’ #’ symbol
# : 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?
The answer:
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. [image-27b0C-1619095955418] the w-h ICH command searches for a system command in the PATH specified by the PATH variable and returns the first 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.
· -p has the same parameter as -n, 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?
The answer:
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?
The answer:
alias la=’ls -a’
34, What are the differences between du and DF?
The answer:
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.
The answer:
Awk ‘{pattern + action} {filenames} # cat/etc/passwd | awk -f’ : ‘ ‘1 “\ t” 7} {print’ / / – F is a ‘:’ the meaning of separating root/bin/bashdaemon /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
36. What do you do when you need to bind a macro or key to a command?
The answer:
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 ‘\e[24 “:”date”‘
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?
The answer:
38, If your assistant wanted to print out the current directory stack, what would you advise him to do?
The answer:
The current directory stack can be printed using the Linux command dirs.
[root@localhost ~]# dirs
/usr/share/X11
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?
The answer:
Use the Linux command ‘disown -r’ to remove all running processes.
What does the hash command in bash shell do?
The answer:
The Linux command ‘hash’ manages a built-in hash table that records the full path of executed commands,
Use this command to print the command you have used and the number of times it was executed.
[root@localhost ~]# hash
hits command
2 /bin/ls
2 /bin/su
41. Which of the bash built-in commands can perform mathematical operations?
The answer:
The bash shell’s built-in command let performs the math of integer numbers.
How to view the contents of a large file page by page?
The answer:
This can be done by piping the command “cat file_name.txt” to ‘more’
Needs.
[root@localhost ~]# cat file_name.txt | more
43, Which user does the data dictionary belong to?
The answer:
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?
The answer:
Use the whatis command to display a summary of the command’s usage. For example, you can use whatis
Zcat Go to see the introduction to ‘zcat’ and a brief introduction to its use.
Which command can be used to check the disk space quota of your file system?
The answer:
The repquota command displays quota information for a file system
Only the root user can view the quota of other users. Full version Java interview questions address: Java backend questions integration