Ubuntu common instructions and usage details

  • 2020-11-25 07:46:04
  • OfStack

1.ls

This is equivalent to the dir command under Windows, which lists the contents of the current or specified window.

2.rm

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 /home/ubuntu/.cache)

Taboo: rm-ES23en /* This command deletes all files under the root partition and, on some efi machines, also deletes the motherboard firmware, causing the motherboard firmware to be lost and unable to boot (worse than the operating system failing to boot).

3.chmod

Change file permissions, similar to the security TAB for file properties under Windows.

Common usage: chmod-R 777 /home/ubuntu/example Change this directory and all the files in it to 777 permissions (777 permissions mean anyone can change this content).

Taboo: chmod-ES37en 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 boot)

4. apt, apt - get

This is similar to the dism 7/8/10 command, which is the Debian family of package managers that can install, update, and uninstall software. root permissions are required for most operations

Common usage: ES58en-ES59en update (Update software source cache)

apt-getupgrade (Update system)

apt-getdist-upgrade (Update system version)

apt-getinstall zhcon (install software called zhcon)

apt-getremove zhcon (uninstall software called zhcon)

No-no: Uninstall critical packages, such as coreutils

5.dpkg

Software installation program.

Common usage: dpkg-ES93en package path and name.

Note: 1 some software packages will be installed after the error, prompt lack of dependency. At this point, you need to enter sudo apt-ES98en-ES99en again to fix the dependency. (You can install gdebi if you want to save time, which is the graphical package installer and can automatically complete dependencies)

6.tar

tar extract extract command. tar.lz requires the INSTALLATION of the lzip package.

tar-xf /home/ubuntu/ ubuntu/coreutils 8.29. tar. xz (unzip this zip to the current directory)

tar-xvf /home/ubuntu/ ES1212en-8.29. tar.xz (unzip this zip to the current directory and display details)

tar-xf /home/ ES134en-8.29.tar.xz /home/ubuntu/gnu (unzip this zip to /home/ubuntu/gnu)

tar-cvjpf etc.tar.bz2 /etc (-ES151en to create 1 package file, the corresponding -ES152en is followed by the name of the file created, using. tar.bz2 suffix, the -ES155en flag USES bzip2 compression, followed by the specific operation object /etc directory)

tar-tar /etc (-ES166en to create 1 package file, corresponding -ES167en followed by the name of the file created, using. tar.gz suffix, -ES170en logo using gzip compression, the last is the specific operation object /etc directory)

7. vi, nano

These are two editors. The latter is recommended if simple text editing is required.

8. sudo, su

sudo is to run this command in root, but with the user configuration of the current user.

Common usage: sudoapt-ES190en update (update software source cache, this command requires root permissions)

sudo-s (switch to root permissions, but use the user configuration of the current user)

su does this, but loads the configuration for the specified user.

Common usage: su (switch to the root user and load the user configuration for that user)

su123 (switch to 123 and load the user's configuration)

su-c "ES212en-ES213en update", switch to root user and update software source cache.

9.fsck

Disk check repair command, which can check to repair file system errors. Similar to chkdsk under Windows. However, the "partition" to be entered here is not the directory after the partition has been mounted, but rather the partition's identity in /dev.

Common usage: fsck/dev/sda1 (check and repair /dev/sda1 partition)

10.zhcon

This is a Chinese plug-in for tty, similar to the Tianhui Chinese character system in the DOS era.

Since Ubuntu will mess up in Chinese mode, it can be solved by using zhcon.

Common usage: zhcon--utf8 (to run zhcon in utf-8 mode, the parameter utf8 is required when running zhcon in general).

zhcon may not be pre-installed, please manually enter sudoapt-ES255en install zhcon for installation.

11.make

Compile the command, depending on your makefile configuration

Add -ES266en to the argument if multithreaded compilation is required < The number of threads > Compile.

If I have a 4-core 8-thread processor, I can type es271EN-j8 to compile, which is much faster.

12.gcc

GCC compiler, depending on your requirements.

13.dd

This command populates the corresponding content to the file.

Common usage: ddif = / home ubuntu/ubuntu iso of = / dev sdc (will ubuntu. iso content into/dev/sdc)

Taboo: ddif=/dev/zero of=/dev/sda This command will reset the main hard disk, causing the system to fail to start and the data to recover.

14.cfdisk

Disk management tool for managing disk partitions and disk images in raw format.

15.whereis

This is the query tool, you can query the specified file.

Common usage: whereisbash (query bash where the program is)

16.touch

Create an empty file

Common usage: ES328en.sh (create update.sh empty file)

17.alias

Set the command alias.

Common usage: aliasdir = 'ls' (set dir as alias for ls)

18.pkill

End the process, similar to the taskkill command under Windows

Common usage: pkillbash (to end the bash process)

19.uname

Displays Linux version, system architecture, and so on.

Common usage: uname-ES363en displays the Linux kernel version number.

uname-ar displays all version information

uname-m displays the current system architecture

20.sync

Write the changes to disk. Because Linux has lazy write (to enhance performance), the contents are not synchronized to disk immediately after performing some operations.

To be on the safe side, for example, the power supply here is unstable and you may experience a power outage, please enter the sync command regularly to prevent accidents.

In addition, the sync command is automatically executed before shutdown and restart, so you do not need the sync command if you are about to shut down or restart.

Common usage: sync synchronizes the current user's data

Running sync as root: Synchronizes all user data.

conclusion


Related articles: