Linux Learning Notes

Source: Internet
Author: User

Cal display Specifies calendar Cal 4 2016

ls file in current directory

Date Display Time Month day

Date +%y-%m-%d 2016-07-30

Date +%h:%m 18:46

BC Enter calculation

Scale=3 three digits after decimal point quit

TAB auto-complete cat xxx (enter to fill) view file contents TAC XXX Reverse View file contents

CTRL + C End current

+++++++++++++++++++++++++++++++++++++++++++++++++++

Ifconfig enp0s3 192.168.1.105 Modify the IP of the Linux network card

Ifconfig ENP0S3 up/down Switch card

Ifconfig enp0s3 View NIC status

Ifconfig enp0s3 netmask 255.255.255.0 Modify the subnet mask

+++++++++++++++++++++++++++++++++++++++++++++++

Ls-l/home/wanglianchen Lists all folders in this directory

Ls-la list all files (including hidden files)

+++++++++++++++++++++++++++++++++++++++++

Man LS displays all commands for LS

+++++++++++++++++++++++++++++++++++++++++

CD back to the user home directory CD. Back to the top level directory

++++++++++++++++++++++++++++++++++++++++++

Su-wanglianchen PWD Displays the current user directory/home/wanglianchen

Su-root Switch User pwd Displays the current user directory/root

+++++++++++++++++++++++++++++++++++++++++++

New file (file action)

Touch Tail.txt New File

mkdir XXX Create Folder

Mkdir-p a/b/c Creating a multilevel directory

RM xxx.txt Deleting files

rm-r XXX Delete Directory

Rm-f Xxx.txt forcibly deleting files

++++++++++++++++++++++++++++++++++++++++++++++

CP xx1 XX2 Copy the xx1 to xx2 (copy) MV Xx1/home move the xx1 file to the home directory

Redirected output ls > 123.txt write the LS list to a 123.txt file (overwrite instead of append) ls >> 123.txt append ls to 123.txt text ls 2> 123.txt writes error message to 123.txt text E Cho "abc" >>123.txt

REDIRECT Input grep xxx < 123.txt find in 123.txt XXX content vi 123.txt edit Text Press ESC input Colon W write file Q exit Edit: W:q

Wc-l 123.txt Statistics rows WC 123.txt output lines + Word count + characters

Ln-s/tmp/1.txt T Create a new shortcut in the current directory point to Tmp/1.txt Soft connect ln-s/tmp/packaging.log t

Echo echoing command can be used to empty file contents echo > Tail.txt

+++++++++++++++++++++++++++++++++++++++++++++++++

Clone a new terminal tail-f tail.txt This command can monitor changes in the contents of the Tail.txt file (-F is used to swipe the screen)

+++++++++++++++++++++++++++++++++++++++++++++++++

Find/-name profile finds files named profiles under the root directory

Cat Xxxprofile |grep xxxcontent find xxxprofile files with xxxcontent content

++++++++++++++++++++++++++++++++++++++++++++++++

Process-related

PS process-related Directives ps-a Show All Processes Ps-ef Show all process details Ps-ef |grep python Search Cable Python process Ps-aux |more

Stat xxxx display file Zodiac equals right-click Property

Hostname display host name hostname XXX Change host name Uname-a current system Properties kill-9 5809 5809 Process number

Netstat-ano |more to view native IP and external IP

++++++++++++++++++++++++++++++++++++++++++++++++

Service-related issues

Services sshd Restart Restart SSH Service chkconfig view service status server iptables stop stop iptables Firewall service

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

Backup and compression

TAR-CZVF XXX.tar.gz 123.txt The 123.txt compressed file is named XXX.tar.gz Gz=gzip

C: Create Z: Compact protocol F: Show file manifest V: Display the file TAR-XZVF tard.gz extract

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Vim Editor

Tapping the I key into the edit mode o key the current line goes to the next line to append a row shift+o the previous line of the current row

Tap ecs/xxx text to find XXX again press n back query next n forward query

s/p1/p2/g P2 replace P1 (current line) N1,n2 s/p1/p2/g N1 row to N2 row P2 replace P1 g/p1/s//p2/g all P1 replaced by P2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Manage users

Who shows all users under current Linux (check)

Who am I show user I logged in

Useradd wanglc-d/home/wanglc-p 123-g User (add) Create users WANGLC user Directory/HOME/WANGLC

"' Secret ' ' ' 1 ' ' 2 ' 3 '" "U ' ser (not specified group-G XXX default to private group) Userdel WANGLC (delete) passwd Usernam e Modify user password (change)

Groups display user user groups

User information is stored in the/etc/passwd file cd/etc cat passwd Cat Shadow

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Manage File permissions

chmod 777 xxxx Root can use chmod to manage file permissions read R (4) write W (2) Run X (1) 777 for readable

Writable to run

Chown wanglianchen:wanglianchen t.txt Change t.txt file to user wanglianchen: User group Wanglianchen belongs to

Chown-r Wanglianchen:wanglianchen A changes All files in the a directory to user wanglianchen: The user group Wanglianchen belongs to

-R: Recursively chgrp all subdirectories to change group permissions

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Pipe: The output of the previous command as input to the next command

ll |wc-l will query to the LL list count rows

Cat 123.txt | Sort-n |uniq >>123.txt The contents of 123.txt in (n) numbers (sort) Uniq duplicate lines not displayed (>>) append to 123.txt text

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Tr ' A-Z ' A-z ' uppercase turn lowercase

Vi. bash_history viewing user-executed command history

Vi. bash_profile Viewing environment variables can be modified if you modify an environment variable, you need to

The source. Bash_profile command makes the. bash_profile file Effective

echo $JAVA _home view JAVA environment variables

ENV View Environment variables

SH xxx.sh Execute shell script

Linux Learning Notes

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.