Common Linux commands and linux commands

Source: Internet
Author: User

Common Linux commands and linux commands

Linux is often used for server deployment. In most cases, you may need to check the commands online and forget them after using them for a long time. Therefore, this article records some commonly used linux commands, for memo. And constantly add.

1. Files And Directories

A. cd: Switch the directory (# cd/sbin ....)

B. mkdir: create a directory (# mkdir test)

C. rm: delete a file or directory (# rm-fr test)

D. cp: copy a file or directory (# cp-fr src dst)

E. ll/ls: view the file content in the current directory

2. system commands

A. View cpu information: #/proc/cpuinfo | grep name | cut-f2-d: | uniq-c

B. Check the linux version: # lsb_release-

C. Restart your computer: # reboot

D. view the process: # ps-aux

E. Killing processes: # kill pis

F. Check where a program is located: # whereis exec

3. compression and decompression

A. tar compression: # tar xcvf dst src

B. Decompress tar: # tar xvf dst

C. zip compression: # zip-r dst src

D. unzip: # unzip dst

4. Commonly Used vi/vim

A. I-> switch to input mode

B. Switch to the command mode.

C. q-> exit command

D.: wq-> Save and exit

5. Open and Close the service

A. Open the firewall: # service iptables start

B. Disable the firewall: # service iptables stop

C. Open mysql: # service mysqld start

D. Disable mysql: # service mysqld stop

6. coredump Problems

A. Modify the core file size: # vi/etc/security/limits. conf, modify the soft core value, and release comments.

B. query the core file size: # ulimit-c

C. debug the core file: # gdb./program: name core: ame

7. Common valgrind startup commands

A. check log and Memory leakage only: # valgrind -- log-file = valgrind. log -- leak-check = full./program: name

8. Dynamic library directory

A. Add the current directory: # export LD_LIBRARY_PATH = 'pwd'

B. view the dynamic library loading Directory: # echo $ LD_LIBRARY_PATH

C. query the dynamic library of an archive: # ldd execname

9. gdb commands

A. ctrl + c: The program is suspended.

B. c: continue running

C. bt: print the current call stack of the current thread

D. thread apply all bt full: print the current call stack of all threads.

E. info local: view all local variables

F. info threads: displays all threads that can be debugged currently.

G. thread ID: Switch the thread of the current debugging to the thread with the specified ID

H, p: View specified variables

I. up: Stack move up
J. down: Stack down

K. step: One-step execution

L. attach pid: attach to the process for debugging

M, break file: linenumber: Add a breakpoint to the specified row of the specified file

N. delete number: delete a specified breakpoint.


What are common linux commands?

Create your own directories and files
Create a directory using mkdir
Create a multi-level directory using mkdir-p
Touch File Creation
Touch-d 20080808 file modification date
Touch-d 1215 file modification time
Modification method at the specified time
Linux does not record the File Creation Time
# Stat big_file
Access: 12:13:00. 000000000 + 0800 Access time cat
Modify: 12:13:00. 000000000 + 0800 content modification time echo>
Change: 17:41:55. 000000000 + 0800 attribute modification time chmod
Touch-m-t 200809101112.13 bigfile

Modify file content
Echo "abcd"> file_name
Add, delete, modify, and save the vim Editor
Gedit

Copy the cp src dest File
-R contains subdirectories and files
-A. Keep the File Permission including subdirectories and keep the file connection
-F: No prompt for force Overwrite
Delete a file rm-r recursively Delete
-F: No prompt for force Deletion
Change mobile name to mvold new
-I Prompt
-F: No prompt for force Overwrite
After learning to view the attributes of a file, let's learn how to view the file content.
Cat-n print row number
Cat-B is the same as cat-B, but empty rows are excluded.
Split screen viewing
More can only be down
Less up/down
More and less search functions
/Search down
? Search up
N next
N previous
Head View File Header
-N X specifies the number of rows
10 rows by default
Tail view the end of a file
-N X specifies the number of rows
-F always monitors file changes
Rev upside down
Tac upside down
Cd back to home directory
Cd/target directory
Cd-last working directory
Cd. Current Directory
Cd .. parent directory
Relative Path and absolute path

Where am I?
Pwd
Tree is displayed in a tree structure

Ls introduces the usage of colors
Why is there a color? Because there are parameters
Long parameter short Parameter
How to view detailed attributes of a file
File Type
-C character l in the d directory of a common file connects to the s socket of the P channel.
How to view hidden files ls-
What should we do when there is no color? Ls-F
Common combination ls-lthr
The system defines the common combination ll l for us.
Custom alias lt = 'LS-lthr'

Common linux commands

Compression and backup:
Bzip2/bunzip2. bz2 File compression/decompression program
Cpio backup file
Dump Backup File System
Gzip/gunzip. gz File compression/decompression program
Gzexe compresses executable files
Restore restores the files backed up by dumping operations or the entire file system (one partition)
Tar archives or reads several files
Unarj decompression. arj File
Zip/unzip compression/Decompression zip file
Zipinfo list details of zip files

Disk operation:
Cd/pwd switch directory/display current working directory
Df Displays disk Information
Du: displays the directory or file size.
E2fsck checks the correctness of the ext2/ext3 File System
Fdisk partitions the hard disk.
Fsck checks the file system and tries to fix the error
Losetup
Ls list directory content
Mkdir create directory
Mformat format formatting the disk of the MS-DOS File System
Mkbootdisk: Create the boot disk of the current system
Create an ext2 File System Using mke2fs
Create an iso disc image file using mkisofs
Mount/umount mount the file system/uninstall the File System
Quota displays the used disk space and restrictions
Sync writes data in the memory buffer to the disk
Tree lists the contents of a directory in a tree chart.

System Operation:
Alias sets command alias
Check chkconfig and set various services of the system
Adjust the RTC time with clock
Date: displays or sets the system time and date.
Dmesg displays boot Information
Eval re-calculates the parameter content
Exit to exit the Current shell
Set or display environment variables in export
Finger finds and displays user information
Free Display memory status
Hostid: displays the host ID.
Hostname display Host Name
Id Display User id
Kill Delete the program or job in execution
Last list information related to users logging on to the system.
Logout
Lsmod displays the modules loaded into the system
Modprobe automatically processes the load-able Module
Passwd Set User Password
Ps process status Report Program status
Reboot
Rhwo view system users
Rlogin Remote Login
Rpm programs used to manage Linux kits
Shutdown
Su switch user changes user identity
Top display, managing programs in execution
Uname: displays system information
Useradd/userdel Add/delete user
Userinfo graphical interface modification Tool
Usermod modifies user attributes, including the shell type and User Group of the user, and can even change the logon name.
W displays the currently registered users and commands that the users are running
Whereis determines the binary Execution Code of a command, the source code and the location of the help
Who lists users using the System
Whois searches for and displays user information

Network Communication:
Arp Address display and Control
Ftp File Transfer
Lftp File Transfer
Send/receive emails
Mesg allows or rejects other users from sending messages to their terminals
Mutt E-mail Management Program
Ncftp file transmission
Netstat displays network connection, route table, and network interface information
Pine sends and receives emails and browses newsgroups
Ping to send an icmp echo request packet to the host on the network
Ssh Security ...... full text>

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.