Introduction to Linux Introductory learning commands

Source: Internet
Author: User
Tags clear screen

Here are some of the notes I made when I was a beginner of Linux, for reference only. Yes, I'm using CentOS.

1.Linux system without drive letter, system installation steps: Partition--format---device file name--set mount point (similar to the drive letter of Windows system).


2. About Linux partition settings: Up to 4, "/" on behalf of the root partition, "swap" for the swap partition, "boot" for the boot partition (Linux system startup space required for 200M is enough).


3. Set or modify the command for the Linux system: Ifconfig eth0 (eth0: Nic name) 192.168.10.121 (you must set the network connection settings for the VM before setting the IP).


4. Remote Connection tool: SECURECRT, this tool can connect a Linux system in a virtual machine.


5. Command DF: View the usage of each partition of Linux.


Commands in the 6.Linux system are strictly case-sensitive and the commands are lowercase.


7. Command ls: View the directory. Ls-l: Long command.


All content in 8.Linux is saved as a file, and is only temporary if it is written in memory.


9.Linux does not differentiate file types by extension.


10.Linux All storage devices must be mounted before users can use them, including hard drives, USB drives, and discs (the software in window cannot be installed directly in Linux).


11. The remote server does not allow shutdown, only restarts, and shuts down the service before restarting.


12.Linux the relationship between a file and a user: the owner (U), the owning Group (g), and others (O).


13. "-" The representative is a file, "D" stands for the directory, "L" stands for a soft connection.


"R" stands for Reading, "W" stands for Write, "X" stands for execution.


The "Ls-a" represents all files (including hidden files), "Ls-l" for long format display details, "ls-d" for the display of directory properties, "Ls-ld" for long format display details (directory), "Ls-h" for humanized display, "Ls-i" for querying out I node.


16.mv/root/aa.conf/tmp/document: Indicates that the aa.conf file under the root directory is clipped to the document directory of the TMP directory.


17.cd/tmp/document: Indicates switching to a directory.


18.rmdir/tmp/document: Indicates the deletion of the directory.


19.rm-rf/tmp/document: The recursive delete directory and subdirectories and files, one-time deletion, no prompt, rm-r/tmp/document: Delete each, there is a hint.


20.rm/root/aa.conf: Indicates deletion of a file, rm-f/tmp/come.conf: Forced delete, no prompt.


21.mkdir-p/TMP/DOCUMENT/ABC: Represents a recursive creation of a directory; TOUCH/TMP/ABC: Creates a file.


22.ctrl+c: Indicates terminating execution of the current command.


23.clear: Clear screen, ctrl+l: Clear screen.


24.cat/tmp/grub.conf: View file contents; tac/tmp/grub.conf: View content upside down.


25.more/etc/services: View a lot of files (after you click the command, space or F to page, enter the line, Q or Q exit), cannot page up.


26.less/etc/service: See a lot of files (after the command, the space or F to page, enter key line, q or Q exit), you can page up, "/service": You can search for keywords.


27.head-n 5/etc/services: Query the first 5 of the contents of the file; Tail-n 5/etc/services: Query the last 5 of the contents of the file, if not write-n is the default query 10.


28. Soft links are equivalent to Windows system shortcuts, hard links are copied files, even if the source files are deleted or can be used.


29.ln-s/etc/issue/tmp/issue.soft: Generates a soft link command (for files only).


30.ln/etc/issue/tmp/issue.hard: Generates a hard-link command (available for files and directories).


31.chmod U=rwx/tmp/install.log: Modify the owner's permissions to R (4) w (2) x (1);

chmod 662/tmp/install.log: Indicates that the permissions to modify "Ugo" are: rw-rw--w-.

32. Permissions considerations: The right to delete a file, depending on whether the user has "W" permissions on the directory where the file resides.


33. Change the owner of the file: Chown ROOT/HOME/XIAOLIN/ABC indicates that the owner of the change ABC file is root and only the root user can operate.


34. Create User: Useradd zhangsan,passwd 123456; Add Group: Groupadd lampbrother.


35. For security reasons, the newly created file does not have executable permissions. Umask-s: Displays the default permissions for the new file.


36.find: File Lookup command; Usage: Find/tmp-name ABC: Search by file name; Find/tmp-iname ABC: Search by file name (case insensitive);

Find/tmp-name *abc*: Search by file name: Fuzzy Lookup;

Find/home-user Shencao: Search according to the owner; Find/home-group brother: Search by the owning group;

Find/-size + 2048: Search for all files larger than 1MB;

Find/tmp-name d*-a-type D: To meet the conditions on both sides of the search, "-o" is to meet the left and right on either side;

Find. -inum 786434-exec rm {} \;: means delete the i node 786434 file (ls/tmp-i: Find File I node).


Minimum unit of 37.Linux storage file: 1 Database block = 512 bytes.


38.which Touch or Whereis touch: View the directory where the command is located.


39.grep content/tmp/test.conf: Find the line where the content is located in a file.


40.locate Teacher.cang: Retrieving files is much faster than the Find command, but the files in the/tmp directory are not retrieved, first updatedb.


41.who command: To see how many users the system has, the W command is also available and more complete.


42.gzip/tmp/services command: Compress files, only package files in Linux, gunzip/tmp/services.gz: Unzip.

TAR-ZXVF dianying.tar.gz command: Unzip. Source files are not preserved.

Zip dianying.zip/tmp/dianying command: The source file is preserved after compression (small compression); Zip-r dianying.zip/tmp/dianying: Compressed directory

Unzip dianying.zip command: unzip;

Bzip2-k boduo Command: Compress the file (compression ratio is maximum, add "-K" can keep the source file); TAR-CJF Boduo.tar.bz2/tmp/boduo: Compress the directory.


42.TAR-CVF japan.tar/tmp/japan command: This can be packaged directory, gzip Japan.tar command: General installation of the source file is this Japan.tar.gz

TAR-ZCVF japan.tar.gz/tmp/japan Command: Package into Japan.tar.gz.

BUNZIP2/TMP/BODUO.BZ2 command: bzip2 decompression; tar-xjf/tmp/boduo.tar.bz2.

43.mail linzhiling Command: Send the message to Lin Chi Ling, after the content is finished, press Ctrl+d to save and send.

Mail directly check the mail, "n" means not viewed, by the serial number of the message to view the message content, press "H" to return to the mailing list.

D 1 Command: Delete the message with a serial number of 1.


44.traceroute www.baidu.com command: Network access.


45.netstat-tlun: View server and monitor. There are also related command Netstat-an.

NETSTAT-RN command: Query the routing gateway.

46.setup command: Used to set the permanent IP address. The Service Network Restart command does not take effect until the Setup command finishes executing.


47.MOUNT/DEV/SR0 (device file name)/mnt/cdrom/(mount point) command: Used to set the mount point.

UMOUNT/DEV/SR0: Used to unload a mount point.


48.shutdown-h now command: shutdown; shutdown-r now command: restart; SHUTDOWN-C now command: Cancels the previous shutdown command.

Try to stop the running service before shutting down or restarting, the general server only restarts, very few shutdown.

49.runlevel: View the run level.


50.logout command: Log out.


51.vim/tmp/test command: Insert the contents of the file;

Press ":" to edit the contents of the file;

Pressing "/string" means finding the specified content;

Press ":%s/old/new/g" to replace the specified content;

Press ": n1,n2s/old/new/g" to replace content within the specified line range;

Three modes of VIM: Command mode, insert mode, edit mode.

Delete operation under the Vim/tmp/test command:

"X" means deleting the character of the cursor;

"NX" means to delete the N characters after the cursor;

"DD" Deletes the line where the cursor is located;

"NDD" means to delete the N rows after the line where the cursor is located.

53.shutdown-r now restarts (root user, try to turn off other running services before restarting).


54.poweroff shut down immediately, because Linux is generally used when the server, generally do not shutdown only restart (shutdown operation is used with caution).


55.shutdown-h now shuts down (root user).


This article is from the "flyfish" blog, make sure to keep this source http://9381188.blog.51cto.com/9371188/1682536

Introduction to Linux Introductory learning 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.