Some common Linux commands

The use of the tab key under linux
  can mainly complete the command. Can command completion and file completion.
     A tab followed by the first string of characters in a sequence of commands is command completion. Following the second string of characters is file completion.

ctrl+c: Interrupt the current command.

ctrl+d: Equivalent to exit, interrupting the current input.

To query what parameters a command has, use man directly. For example: man date is to query the information of the date command.

main -k write: Query files with write strings in the files. Querying files is very convenient. Can be replaced by apropos.

To change the permissions of a file, use:
chown: Change the owner of the file.
chgrp: Change the group permissions of the file.
chmod: Change the read, write and execute permissions of the file.

fg: View background processes.

jobs -l: The option displays the PIDs of all tasks, and the process can then be killed by kill process ID.

bg: Change a command that was paused in the background to continue executing in the background.

Log in as the root account from a normal account: sudo -i: Enter the current account password. Log in from the root account to see the things of other accounts directly cd /home/account name.

rm -rf foldername: delete an entire folder.

mv file name before modification: file name after modification: modify the folder name.

pwd : prints the current directory, pwd -P prints the current actual directory. (Some directories may be shortcuts)

mkdir: Create a file. mkdir -p can create folders recursively. mkdir -m sets the created dir permissions.

rmdir: deletes an empty folder. If there is content in it, it cannot be deleted. rmdir -p: can delete folders recursively.

cp: Copy a file to the current directory. If it is a directory, it cannot be directly copied to add the -r parameter. Add -s to suggest a shortcut.

mv: used to move can also be used to rename files.

cat starts to display the file content from the first line (equivalent to reading a file)

tac starts to display from the last line, it can be seen that tac is the reverse of cat!

When nl is displayed, output the line number along the way! 
more shows the contents of the file page by page less is similar to more, but better than more, he can turn pages forward!

head only looks at the first few lines

tail only looks at the tail a few lines

od reads the contents of the file in binary mode.

touch: Suggest a new file. The time that can be used to modify the file.

which: look for instructions. For example: which ls.

whereis: Search the path where a file is located.

locate: Search the path where a file is located, which is equivalent to a fuzzy query.

find: can also be used to search the path where a file is located but will scan the hard disk. Not as efficient as whereis and locate.

cut: similar to java's substring string interception.

grep: Find lines containing strings.

su -: Temporarily gain root privileges.

df: Display remaining capacity. df -h displays the capacity in an easy-to-read format.

du: Displays the capacity of each directory under the current directory.

ln: Create shortcut. A hard link is created without parameters. Plus the parameter -s is a symbolic link (equivalent to a shortcut).

gzip: Compress files in gzip format. The compressed file name suffix is ​​gz.

zcat: View gz-compressed files in plain text format. (No need to unzip)

bzip2: Compress files in bzip2 format. The suffix of the compressed file name is bzip2.

bzcat: View bzip2 compressed files in plain text format. (No need to decompress)

tar: Package the files.

echo: print the contents of the variable.

export: Change the variable into a system variable.

alias: View aliases for commands and set aliases for commands.

unalias: Unalias.

history: Query the executed historical commands.

!!: Execute the previous command.

sort: sort.

useradd: create a user.

&: Put the task into the background to execute.

ctrl + z : Pause the current task and put the task in the background.

kill: Kill the background process. -9 Force kill a process.

ps: Statically display all processes.

top: Dynamically display all processes.

free: The current memory usage of the system.

netstat: Query the status of network usage.


install software command sudo dpkg -i
request to download dependencies sudo apt-get install -f
open pdf evince

Commonly used partitions under linux are:
/: root directory.
/usr: Stores the linux operating system.
/home: Information for all users.
/var: Login files for all default servers.
Swap: Virtual swap memory. Generally 2 times the size of the positioning memory.
/boot: The linux boot read directory.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326488203&siteId=291194637