Linux Common commands

Source: Internet
Author: User

PASSWD Enter Change Password

CD into the personal home directory
Cd/home Enter '/home ' directory
Cd.. Return to the top level directory
Cd.. /.. Return to the top level two directory
CD-Return to the last directory

ls to view the files in the directory
Ls–f viewing files in a directory
Ls–l View details of files and directories
ll view details of files and directories
Ls–a Viewing hidden files
LS *[0-9]* view filenames and directory names that contain numbers


Tree displays files and directories starting with the root directory
Lstree Show files and directories with a tree structure starting with the root directory

mkdir AAA Create a directory of ' AAA '
mkdir AAA BBB simultaneously creates ' AAA ' and ' BBB ' two directories
MKDIR–P/AAA/BBB/CCC Creating a directory tree
Rm–f AAA Delete ' AAA ' files
rmdir BBB Delete the ' BBB ' directory
RM–RF AAA Delete ' AAA ' directory and delete its contents at the same time
RM–RF AAA BBB also deletes two directories and their content


VI aaa.txt Edit Aaa.txt file contents
: W Save
: w! Force Save
: Wq Exit and save
: wq! Force Save and exit
: Q Do not save and exit
: q! Force quit does not save
: e! Restore a file to its original state
ZZ If the file does not change, then does not store leave, if the file has changed, then the store left
: w [FileName] stores the edited data as another file
: Set NU Displays line number
: Set Nonu Cancel line number

PWD Displays the path of the current user

Rz–y Uploading Files
Sz–y Download File

File Search
Find/-name file1 from '/' to the root file system to search for files and directories
Find/-user User1 search for files and directories belonging to user ' User1 '
Find/home/user1-name \*.bin in directory '/home/user1 ' search for files with '. Bin '
Find/usr/bin-type f-atime +100 Search execution files that have not been used in the last 100 days
Find/usr/bin-type f-mtime-10 search for files created or modified within 10 days
Find/-name \*.rpm-exec chmod 755 ' {} '; Search for files ending with '. RPM ' and define their permissions
Find/-xdev-name \*.rpm search for files ending with '. RPM ', ignoring removable devices such as optical drives, Czech disks, etc.

MySQL Database command
Cd/usr/local/mysl/bin into the Mysqlbin directory
./mysql–uroot–p Connect to database, enter password
Select User (); Querying all Users
show databases; Show all database names
Use PSMs; Go to the ' psms ' database
Show tables; Show all the tables

Source/root/psms.sql Import the Psms.sql database under the root directory;

/usr/local/mysql/bin/mysql–uroot–pfwipsadmin Connection Database
/usr/local/mysql/bin/mysqldump–d–uroot–pfwipsadmin psms audit_num > Audit_num.sql Export psms table in Audit_num database, rename audit _num.sql file

SZ audit_num.sql download Audit_num.sql to local

TAR-ZXVF sms.tar.gz-c/usr/local/httpd/htdocs/Decompression Package

Commands to delete millions files
mkdir Newfloder
Rsync-a-delete newfloder/cur/

For i in *;d o rm-fr i; Done

Find/home/mailbox/pldsec.com/pldsec/maildir/cur-name ' *email* '-print | Xargs-n1 RM-FR

Rm-rf

ls ' *.email* ' | Xargs rm–f

Downloading files from sftp under Linux
Lftp-c "Open-e ' get-o./(current directory)/usr/local/jdk-7u51-linux-i586.tar.gz-o ' sftp://' root ': ' pldsec ' @192.168.1.145:22 '

File MD5 Checksum
md5sum filename

Modify the DNS configuration vi/etc/resolv.conf add nameserver 8.8.8.8 in this file

Update system time Ntpdate time-a.nist.gov

Touch/etc/pldrun.ctl shutting down the telnet port

Linux Common commands

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.