In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. What symbol is used to represent the absolute path? What is the current directory and the upper directory? What is the expression of the main catalogue? What command is used to change directories?
Answer:
Absolute path: such as / etc/init.d
Current directory and upper directory:. /.. /
Home directory: ~ /
Change the directory: cd
2. How to view the current process? How to perform an exit? How do I view the current path?
Answer:
View current process: ps
Execute exit: exit
View the current path: pwd
3. How to clear the screen? How do I exit the current command? How to perform sleep? How to view the current user id? What command is used to view the specified help?
Answer:
Clear screen: clear
Exit the current command: ctrl+c exits completely
Perform sleep: ctrl+z suspends current process fg resumes background
View the current user id: "id": view the uid and gid of the current login account and the grouping and user name to which they belong
Check out the specified help: such as man adduser, which is complete and has examples; adduser-- help, which tells you some common parameters; info adduesr
4. What function does the Ls command perform? What parameters can you take? what's the difference?
Answer:
Functions performed by ls: list the directories in the specified directory, as well as files
What parameters and differences: an all file l details, including size bytes, readable, writable and executable permissions, etc.
5. Create soft links (shortcuts) and commands for hard links.
Answer:
Soft link: ln-s slink source
Hard links: ln link source
6. What command is used to create the directory? What command is used to create a file? What command is used to copy files?
Answer:
Create a directory: mkdir
Create a file: typically, touch,vi can also create a file, but it will create a file as long as it is exported to a file that does not exist.
Copy file: cp 7. What command is used to modify file permissions? What's the format?
File permission modification: chmod
The format is as follows:
Chmodu+xfile adds execution permissions to file owners chmod 751 file assigns read, write, execute (7) permissions to file owners, read and execute permissions to file groups, and execution permissions to other users
Another form of chmodu=rwx,g=rx,o=xfile example chmod = r file assigns read permissions to all users
Chmod444file is the same as the previous example, chmod a, wxj, file, and the same as above.
$chmod-R uplir directory recursively assigns read permissions to the owners of all files and subdirectories under the directory directory
7. What commands can be used to view the contents of the file?
Answer:
Vi file name # can be modified by editing
Cat file name # shows all file contents
More file name # paging to display the contents of the file
The less file name # is similar to more, but even better, you can turn the page forward.
Tail file name # View the tail only, you can also specify the number of lines
Head file name # View headers only, you can also specify the number of lines
8. Command to write documents at will? How to output a string with a space to the screen, such as "hello world"?
Answer:
Write file command: vi
Output a string with spaces to the screen:
Echo hello world currency symbol http://www.gendan5.com/currencyworld.html
9. Which file under which folder is the terminal? Which command is the black hole file under which folder?
Answer:
Terminal / dev/tty
Black Hole File / dev/null
10. Which command is used to move files? Which command do you use to change your name?
Answer:
Mv mv
Which command is used to copy files? What if you need to copy it with the folder? What if there is a prompt function?
Answer:
Cp cp-r?
12. Which command is used to delete files? What if you need to delete both the directory and the files under the directory? What command is used to delete an empty folder?
Answer:
Rm rm-r rmdir
13. What are the wildcards that can be used in Linux commands? What do they stand for?
Answer:
"?" Can replace a single character.
"*" can replace any number of characters.
Square brackets "[charset]" can replace any single character in the charset set, such as [Amurz], [abABC]
14. What command is used to count the contents of a file? (line number, word count, byte count)
Answer:
The wc command-c counts bytes-l counts rows-w counts words.
What is the use of the Grep command? How to ignore case? How do I find a line that does not contain the string?
Answer:
Is a powerful text search tool that uses regular expressions to search for text and print matching lines.
Grep [stringSTRING] filename grep [^ string] filename
16. What are the states of a process in Linux? What symbols are used to represent the information displayed by ps?
Answer:
(1) uninterruptible state: the process is asleep, but at the moment the process is uninterruptible. Uninterruptible, which means that the process does not respond to asynchronous signals.
(2) pause state / tracking state: send a SIGSTOP signal to the process, it will enter the TASK_STOPPED state in response to the signal; when the process is being tracked, it is in the special state of TASK_TRACED. "being tracked" means that the process pauses and waits for the process that tracks it to operate on it.
(3) ready state: the state in the run_queue queue
(4) running status: status in run_queue queue
(5) interruptible sleep state: a 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)
(6) zombie status (zombie): the father will release the task_struct of the child process without passing the system call of the wait series.
(7) exit status
D non-interruptible Uninterruptible (usually IO)
R is running, or a process in queue
S is dormant.
T stops or is tracked
Z zombie process
W enters memory swap (invalid since kernel 2.6)
The process of X's death
17. How to make a command run in the background?
Answer:
It is common to use & at the end of the command to make the program run automatically. (no spaces can be appended after the command)
18. How to display all the processes using ps? How to use ps to view the information of a specified process?
Answer:
Ps-ef (system v output)
Output in ps-aux bsd format
Ps-ef | grep pid
Which command is specifically used to view background tasks?
Answer:
Jobs
20. Transfer the background task to the foreground to execute what command? What commands are used to execute stopped background tasks in the background?
Answer:
Transfer the background task to the foreground to execute fg
Execute the stopped background tasks in the background, bg
21. What command is used to terminate the process? What parameters do you bring?
Answer:
Kill [- s] [program] or kill [- l]
Kill-9 pid
22. How to check all the signals supported by the system?
Answer:
Kill-l
23. What command is used to search for files? What's the format?
Answer:
Find
Whereis plus parameters and file name
Locate adds only the file name
Find searches the disk directly, which is slower.
Find /-name "string*"
24. Check who is currently using the host and what commands are used? What command is used to find the terminal information where you are located?
Answer:
Find the terminal information where you are located: who am i
See who is currently using the host: who
25. What command do you use to view a list of used commands?
Answer:
History
26. What command is used to view disk usage space? What about free space?
Answer:
Df-hl
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% / boot
27. What command is used to check whether the network is connected?
Answer:
Netstat
28. What command is used to view ip address and interface information?
Answer:
Ifconfig
29. What commands are used to view various environmental variables?
Answer:
View all env
Check out some, such as home: env $HOME
30. What command is used to specify the command prompt?
Answer:
\ U: show the current user account
\ h: show current hostname
\ W: only the last directory of the current path is displayed
\ w: displays the current absolute path (the current user directory will be replaced by ~)
$PWD: displays the current full path
$: displays the command line'$'or'# 'symbol
#: the number of orders issued
\ d: represents a 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: the display time is in 12-hour format
\ a: display time is 24 hours format: HH:MM
The version information of\ v:BASH, such as export PS1=' [\ u@\ h\ w#] $'
31. Where can I find the executable file of the search command? How to set and add it?
Answer:
Whereis [- bfmsu] [- B...] [- M...] [- S...] [file.]
Additional note: the whereis directive looks for files that meet the criteria in a specific directory. The intensity of these files should belong to the original code, binaries, or help files.
-b looks for only binaries.
-B only looks for binaries in the set directory. -f does not display the path name before the file name.
-m only looks for description files.
-M only looks for description files in the set directory. -s only looks for the original code file.
-S only looks for the original code file in the set directory. -u looks for files that do not contain the specified type.
The w-h ich instruction searches for the location of 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, which must be greater than or equal to the longest file name of all files.
The-p parameter is the same as the-n parameter, but here the path to the file is included. -w specifies the width of the field on output.
-V displays version information
32. What commands are used to find and execute commands?
Answer:
Which can only look up executable files
Whereis can only look up binaries, documentation, source files, etc.
33. How to alias the command?
Answer:
Alias la='ls-a'
34. What are the definitions of du and df, and the differences?
Answer:
Du displays the size of a directory or file
Df displays information about each file system on which it resides, and all file systems are displayed by default. The file system allocates some of these blocks to record some of its own data, such as I nodes, disk maps, indirect blocks, super blocks, and so on. This data is invisible to most user-level programs, 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 diagram 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.
35. Awk detailed explanation.
Answer:
Awk'{pattern + action}'{
Filenames
}
# cat / etc/passwd | awk-F':'{print 1 "t" 7}'/ /-F means to separate the root by':'
/ bin/bash
Daemon / bin/sh search / etc/passwd all lines with the root keyword
# awk-F:'/ root/' / etc/passwd root:x:0:0:root:/root:/bin/bash
36. What should you do when you need to bind a macro or press a key to a command?
Answer:
You can use the bind command, and bind can easily bind macros or keys in shell. When doing key binding, we need to first get the character sequence corresponding to the binding key.
For example, the way to get the character sequence of F 12 is as follows: press Ctrl+V first, and then press F 12. We can get the character sequence ^ [24 ~] of F12.
Then use bind for binding.
[root@localhost ~] # bind'"e [24 ~": "date"'
Note: the same keystroke may produce different character sequences under different terminals or terminal emulators.
[attached] you can also use the showkey-a command to view the character sequence corresponding to the keystroke.
37. If a novice to linux wants a list of all the commands supported by the current system, what does he need to do?
Answer:
Using the command compgen-c, you can print out 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
Done
...
38. If your assistant wanted to print out the current directory stack, what would you advise him to do?
Answer:
The current directory stack can be printed out using the Linux command dirs.
[root@localhost ~] # dirs
/ usr/share/X11
[attached]: the directory stack is operated through pushd popd.
39. Your system currently has many running tasks. Is there any way to remove all running processes without restarting the machine?
Answer:
Use the linux command 'disown-r' to remove all running processes.
40. What is the purpose of the hash command in bash shell?
Answer:
The linux command 'hash' manages a built-in hash table that records the full path of commands that have been executed, with which you can print out the commands you have used and the number of times they have been executed.
[root@localhost ~] # hash
Hits command
2 / bin/ls
2 / bin/su
41. Which bash built-in command can perform mathematical operations?
Answer:
Bash shell's built-in command let can perform mathematical operations on integers.
#! / bin/bash
...
...
Let c=a+b
...
...
42. How to view the contents of a large file page by page?
Answer:
This can be achieved by piping the command "cat file_name.txt" with "more'".
[root@localhost ~] # cat file_name.txt | more
43. which user does the data dictionary belong to?
Answer:
The data dictionary belongs to the 'SYS' user', and the user 'SYS' and' SYSEM' are automatically created by the system by default
44. How do I view a summary and usage of a linux command? 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?
Answer:
Use the command whatis to show a brief usage of this command, for example, you can use whatiszcat to see an introduction to 'zcat' and a brief introduction to the usage.
[root@localhost ~] # whatis zcat
Zcat [gzip] (1)-compress or expand files
Which command can I use to view the disk space quota of my file system?
Answer:
Use the command repquota to display quota information for a file system
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.