This is equivalent to the dir command under Windows, which can list the contents of the current window or the specified window.
This is equivalent to the del and rmdir commands under Windows, which can delete files and folders.
Common usage: rm -rf/home/ubuntu/.cache
(delete the folder /home/ubuntu/.cache)
Taboo: rm-rf /* This command will delete all files in the root partition. On some efi machines, it will also delete the motherboard firmware, causing the motherboard firmware to be lost and unable to boot (more serious than the operating system failure).
Changing file permissions is similar to the security tab of file properties under Windows.
Common usage: chmod-R 777 /home/ubuntu/example
(change the directory and all files in it to 777 permissions (777 permissions mean anyone can modify the content)).
Taboo: chmod-R 777 /etc
chmod-R 777 /
( The root partition and /etc are critical parts of the system, and changing permissions will cause the system to fail to start)
This is similar to the dism command of Win7/8/10, which is the package manager of the Debian series, which can install, update, and uninstall software. Most operations require root privileges
Common usage: apt-get update (update software source cache)
apt-getupgrade (update system)
apt-getdist-upgrade (Update system version)
apt-getinstall zhcon (install the software named zhcon)
apt-getremove zhcon (uninstall the software named zhcon)
Taboo: Uninstall key software packages, such as coreutils
Software installer.
Common usage: dpkg -i package path and name.
Note: Some software packages will report an error after installation, prompting lack of dependencies. At this time, you need to enter sudo apt-get -finstall again to repair dependencies. (If you want to save trouble, you can install gdebi, which is a graphical package installer, and it can automatically complete dependencies)
tar compression and decompression commands. To compress and decompress tar.lz, you need to install the lzip software package.
Common usage: tar-xf /home/ubuntu/coreutils-8.29.tar.xz (decompress this compressed package to the current directory)
tar-xvf /home/ubuntu/coreutils-8.29.tar.xz (decompress this compressed package to the current directory and display detailed information)
tar-xf /home/ubuntu/coreutils-8.29.tar.xz /home/ubuntu/gnu (decompress this compressed package to the /home/ubuntu/gnu directory)
tar-cvjpf etc.tar.bz2 /etc (-c is to create a packaged file, the corresponding -f is followed by the name of the created file, using the suffix of .tar.bz2, the -j flag is compressed using bzip2, and the last is specific Operation object /etc directory)
tar-cvzpf etc.tar.gz /etc (-c is to create a packaged file, the corresponding -f is followed by the name of the created file, using the .tar.gz suffix, the -z flag is compressed using gzip, and the last is specific Operation object /etc directory)
These are two editors. The latter is recommended if simple text editing is required.
sudo is to make this command run in the root state, but use the user configuration of the current user.
Common usage: sudoapt-get update (update software source cache, this command requires root privileges)
sudo-s (switch to root privileges, but use the user configuration of the current user)
su can achieve the above functions, but will load the configuration of the specified user.
Common usage: su (switch to the root user and load the user configuration of that user)
su123 (switch to 123 and load the user configuration of that user)
su-c "apt-get update", switch to the root user and update the software source cache.
Disk check and repair commands can check and repair file system errors. Similar to chkdsk under Windows. However, the "partition" to be entered here is not the directory after the partition is mounted, but the identifier of the partition in /dev.
Common usage: fsck/dev/sda1 (check and repair /dev/sda1 partition)
This is a Chinese plug-in for tty, similar to the Tianhui Chinese character system in the DOS era.
Since tty will be garbled in Chinese mode in Ubuntu, it can be solved by using zhcon.
Common usage: zhcon–utf8 (Run zhcon in utf-8 mode. Generally, the parameter –utf8 is required when running zhcon).
zhcon may not be pre-installed, please manually enter sudoapt-get install zhcon to install it.
Compile command, the specific parameters depend on your makefile configuration
If you need to use multi-threaded compilation, you can add -j <thread number> to the parameter to compile.
For example, my processor has four cores and eight threads, so I can type make -j8 to compile, which will be much faster.
GCC compiler, the specific parameters depend on your needs.
This command can fill the corresponding content into the file.
Common usage: ddif=/home/ubuntu/ubuntu.iso of=/dev/sdc (write the content of ubuntu.iso to /dev/sdc)
Taboo: ddif=/dev/zero of=/dev/sda This command will clear the main hard disk, causing the system to fail to boot and data recovery.
Disk management tools can manage disk partitions and disk image files in raw format.
This is a query tool that can query specified files.
Common usage: whereisbash (query where is the program bash)
Create empty file
Common usage: touchupdate.sh (create an empty update.sh file)
Set the command alias.
Common usage: aliasdir ='ls' (set dir as the alias of ls)
End the process, similar to the taskkill command under Windows
Common usage: pkillbash (end bash process)
Display information such as Linux version and system architecture.
Common usage: uname-r displays the Linux kernel version number.
uname-ar show all version information
uname-m displays the current system architecture
Write the changes to disk. Since Linux has a delayed write function (in order to enhance performance), it does not synchronize the content to the disk immediately after performing some operations.
To be on the safe side, for example, if your power supply is unstable, you may encounter a power failure. Please enter the sync command regularly to prevent accidents.
In addition, the system will automatically execute the sync command before shutting down and restarting, so if you are about to shut down or restart, you do not need the sync command.
Common usage: sync to synchronize the current user's data
Run sync as root: synchronize all user data.
to sum up
The above is a detailed explanation of common Ubuntu commands and usage introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message. The editor will reply to you in time. Thank you very much for your support to the ZaLou.Cn website!
Recommended Posts