Linux (Ubuntu) Common commands, linuxubuntu

Source: Internet
Author: User
Tags rpmbuild

Linux (Ubuntu) Common commands, linuxubuntu

Play to Linux: a selection of terminal command usage
I picked up Ubuntu again recently. For better fun with Linux, the commonly used terminal commands found on the Internet are divided into nine categories according to different command categories, I personally think it is very useful to list all of them below. In the future, the younger brother will update his usage of Ubuntu at any time.
 
File directory
1. Create a directory: mkdir directory name
2. Delete the empty directory: rmdir directory name
3. Delete the subdirectory unconditionally: rm-rf directory name
4. Change the current directory: cd directory name (go to the user's home directory: cd ~; Go to the upper-level Directory: cd -)
5. view your own directory: pwd
6. view the current directory size: du
7. display the directory file list: ls-l (-a: add an implicit directory)
Blue: Directory; Green: executable file; Red: compressed file; light blue: linked file; Gray: other files; Red: Wrong link file
8. Browse File: morefile name .txt;lessfile name. txt
9. copy the file: the target file of the cp source file (-r: Contains directory)
10. find the file: (1) find (2) locate command name
11. Link: (1) create a hard link: ln to link the source file (-d: create a directory link); (2) create a symbolic link: ln-s to link the source file
 
Ii. Driver mounting
1. Check hard disk usage: df-T-h
2. Check the disk partition: fdisk-l
3. mount the hardware and software areas: mount-t/dev/fdx | hdax/mnt/directory name
Among them: modos -- FAT16; vfat -- FAT32; ntfs -- NTFS; optical drive -- iso9660
Supported Chinese names: mount-o iocharset = x/dev/hdax/mnt/directory name (where: x = cp936 or
Mount the optical drive: mount-t auto/dev/cdrom/mnt/cdrom
Mount the ISO file: mount-t iso9660-o loop xxx. iso/path
4. unmount: umount/mnt/directory name
Unmount all: umount-
5. Create a file system: mkfs-t/dev/hdxx. Ftype: ext2, ext3, and swap
 
Iii. Program Installation
1. RPM package installation: (1) install rpm-ivhsomesoft. rpm
(2) reverse install rpm-esomefost. rpm
(3) query rpm-qsomefost or rpm-qpi somefost. rpm (where: p is not installed; Information contained in I)
(4) query the location after installation: rpm-ql somefost. rpm
(5) upgrade and install: rpm-Uvh somesoft. rpm
(6) force installation: rpm-ivh -- nodeps somesoft. rpm or rpm-ivh -- nodeps -- force somesoft. rpm
 
2. Install the source code package:
Read README
Basic usage (1) configuration: extract the directory./configure
(2) Compile: extract the make
(3) install makeinstall in the decompressed directory
3. Install src. rpm
The -- rebuild parameter must be added to the rpmbuild command. For example, rpmbuild -- rebuild ***. src. rpm. Then, find it under/usr/src /.
3. Install the iso program in FC3: directory where system-config-packages -- isodir = iso is located
Install the iso program under RH: directory where redhat-config-packages -- isodir = iso is located
 
Iv. compression and decompression
1.tar.gz class: (1) extract: tar-xvzf file .tar.gz((2)tar.gz to tar: gzip-d file .tar.gz (2) compression: gzip file to be compressed
2.tar uncompressed class: (1) Unpack: tar-xvf file .tar; (2) package: tar-cvf file .tar file list
3.zip: (1) unzipfile. Zip-d dir; (2) Compressed: zipzipfile list of files to be compressed
4.bz2 class: (1) Decompression: bunzip2 file .bz2 or bzip2-d file .bz2; (2) compression: bzip2 files to be compressed
5. z class: (1) decompress: uncompress file. z; (2) compress: compress File
 
5. Process Control
1. List the current process ID: ps-auxw
2. terminate processes: (1) terminate a single process: kill process ID
(2) terminate all processes of the program: Killall program name
(3) Terminate the X-Window program: xkill
3. View resource usage: (1) top (2) free (3) dmesg
4. view the environment variable value: env
5. Restart: (1) reboot (2) Ctrl Alt Del (3) init 6
6. shutdown: (1) shutdown-h now (2) halt (3) init 0
7. Switch the desktop: switchdeskgnome | KDE |...
 
6. program running
1. query command: whereis command name
2. Run the X-Window program in the background: program name &
3. Forcibly exit the X-Window program: CtrlAlt Backspace
4. View help:
(1) Concise help: command name -- help | less
(2) more help: man command name
(3) info command name
(4) help command name
5. view the system PATH: echo $ PATH
6. view the current shell Stack: echo $ SHLVL
7. </>: Input/Output redirection. |: The left input of the MPs queue is the right input of the MPs queue.
 
6. User Accounts
1. Add a user account: (1) User name: adduser User Account Name
(2) Set Password: passwd User Account Name
2. delete a user account: userdel User Account Name
3. Add a user group: groupadd user group name
4. delete a user group: groupdel user group name
5. Temporarily terminate the user account: passwd-l User Account Name
6. Restore the account to be terminated: passwd-u User Account Name
7. permission settings
(1) chmod-a | u | g | o |-| = r | w | x file/directory name
Where: a -- all users (all); u -- current user (user); g -- user group (group); o -- other users (otherusers)
-- Add permissions; --- delete permissions; = -- Set permissions
File: r -- read-Only permission (read); w -- write permission (write); x -- execute permission (execute)
Directory: r -- allow files and subdirectories in the column directory; w -- allow generation and deletion of files in the directory; x -- allow access to this directory
(2) chmodxxx file/directory name
Where: execute = 1; write = 2; read = 4
Value x: 0 -- no permission (commonly used); 1 -- can only be executed (uncommon); 2 -- can only be written (uncommon ); 3 -- write and execution only (uncommon); 4 -- read-only (common); 5 -- read-only and execution (common); 6 -- read and write (common); 7 -- read. write and execute
 
VII. vi editing
1. Enter the command mode: (1) Insert I; (2) Open 0; (3) Modify c; (4) Replace r; (5) replace s
2. After going through (1), enter the full screen editing mode.
3. Command mode --> edit mode (a/I); edit mode --> command mode (Esc); command mode --> last line mode (:).
4.: w/wnewfile save
5.: q/q! Exit iv;: wq save and quit
 
VIII. Network Services
1. display network interface parameters: ifconfig
2. Display System Email: mail
3. start/stop the web Service: httpd-k start | stop | restart
4. View network conditions: (1) online status: pingxxx. xxx;
(2) display network status: netstat, where: options:-a = All sockets;-l = contains network devices;-n = Digital IP;
-O = Other information;-r = route table;-t = only columns TCPsockets;-u = only columns UDPsockets;-w = only columns rawsockets;
-X = only columns of UnixDomain sockets

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.