Linux common commands and details

                            

Linux System Description

  Linux (born 1991.10.5) inherits the design philosophy of Unix network-centric, performance is stable and a multi-user network operating system.

  Linux is an indicator of the Linux kernel in the strict sense, but every day it is customary to use to describe the entire Linux kernel based on Linux and uses the GNU (a free operating system) operating system tools and databases of various projects. Common with mainstream products as ubuntu, CentOS, Debian, redhat, "Kylin" and the like.

  Note, Linux systems are all based, Linux operating system forms the root of the file is used to store data.

Advantages and disadvantages of Linux

A. Advantages

  1.Linux based network connection, remote convenience: as long as a privilege, the user can easily control the linux server far away in the Cape, the bandwidth required is small.

  2. open source and highly customizable: open source developers in favor of the needs to modify to customize according to their own systems, so linux can easily adapt to different environments of different users.

  3. Linux command line powerful, reusable with editable properties

  4. decentralized: decentralized software development, creating interfaces and forms of the system is not uniform, full of personality linux.

  5.linux supports simultaneous multiplayer on-line work, resource allocation reasonable and average

II. Disadvantages

  1. No specific software support, professional single function software

  2. The lack of game support

Linux common commands

Preliminaries

  First, enter the Linux system, you can see xxx 'home (the equivalent of the account under windows), Computer (equivalent to "my computer" under windows) and Trash (Recycle Bin). Mentioned above, linux file system is based on the All directory / file based on a root directory for that (Filesystem) "/", with Xshell other terminals connected (or linux on a virtual machine) tool to connect linux server, is the first to see:

  

  Here the "~" address (Subrogation character) represents the personal directory, different user logs is their address, as root, for example, "~" stands for / root /

The role of each directory in the root directory 

  cd / into the root directory

  ls view files and subdirectories under the current directory

  

  (Smaller font block codes, can be accessed by browser alt + 'on the rollers' to enlarge view)

  / Bin kept the average user commands (binary executable command)
   / dev system device (driver)
   / Home user's home directory bps
   / lost- time found when the system is not shut down properly, leaving the temporary files are stored in the directory next (usually empty directory)
  / proc store the user's interaction with the kernel information
   / sbin storage system program administrators
   database directory / srv system startup service can access the 
  / tmp temporary files, reboot the system automatically empty the
  / var large files the overflow area (such as various service log files)
  core file / boot boot the system
  all the configuration files / etc system
  / lib storage and systems related to the operation of the library
  / mnt mount directory (system administrator to install temporary installation files point)
  / Media storage devices (such as U disk, etc.) can remove the
  / opt source installation directory location
  / root directory super administrator
  / selinux safety-related systems, reinforcement systems
  / sys management device file
  / usr most commonly used. the largest catalog, kept the applications and files

The system information common commands

  date display system
    date 072,018,002,019.00 set the date and time format - month, day, hour in seconds, the current representation:. 2019 // 7/20 18:00:00 
    Clock - w will save time to modify the BIOS 
  CAL 2019 show calendar 2019 
  arch show architecture of machine
  uname -m show architecture of machine
  uname -r to display the kernel version you are using
  cat / proc / cpuinfo show information CPU info 
  cat / proc / interrupts show interrupts 
  cat / proc / meminfo verify memory use 
  cat / proc / swaps show which swap used 
  cat / proc / version show version of the kernel 
  cat / proc / net / dev show network adapter and statistics 
  cat / proc / mounts show mounted file system 

Common commands of system operation 

  shutdown -h now immediately shut down the system
        -h hours: minutes & shutdown of the system-minute
        -c cancel shutdown of the system time
        -r now reboot
  init 0 Turn off the system
  telinit 0 shut down the system
  reboot reboot
  logout Logs

Common commands of the file / directory operations (view, create, delete, move, copy, decompression, compression, etc.)

  statement: 

  Reference section:  https://www.cnblogs.com/yjd_hycf_space/p/7730690.html

  Garden author blog:  https://www.cnblogs.com/yjd_hycf_space/ 

  

-------------------------------------------------- - 
  cd / usr / local / enter the src ' / usr / local / the src ' directory
  cd .. go back one level   cd go to home directory   cd ~ user1 go to home directory   cd - Back to the previous directory where   pwd display working directory   ls view files in a directory   ls - files F View directory   ls - L show details of files and directories   ls - a show hidden files   ls * [ 0 - 9 ] * displays the file and directory names containing numbers   tree show the tree structure of files and directories starting from the root directory   lstree display files and directories starting from the root of the tree   mkdir dir1 create one called ' dir1 ' directory'   Mkdir dir1 dir2 create two directories simultaneously   mkdir -p / tmp / dir1 / dir2 create a directory tree   RM -f file1 delete called ' file1 ' file '   rmdir dir1 delete called ' dir1 ' directory '   RM -rf dir1 delete called ' dir1 ' directory and delete its contents   RM - the RF dir1 dir2 remove two directories at the same time and their contents   mv dir1 new_dir rename / move a directory   cp file1 file2 copying a file    cp dir / * copy a directory. all files in the current working directory   cp -a / tmp / dir1. copy a directory within the current work directory   cp -a dir1 dir2 copy a directory   ln -s file1 lnk1 create a link to the file or directory soft link   ln file1 lnk1 points to create a physical link to file or directory
-------------------------------------------------- - 
  the Find / -name file1 from '/' began to enter the root file system search for files and directories
 
  find / -user user1 search belongs to the user 'user1' files and directories 
  . find / home / user1 -name \ * cfg directory '/ home file / user1 'with the search' end .cfg 'of
---------------------------------------------------
  useradd -c "Name Surname" -g admin -d / home / user1 -s / bin / bash user1 create a user belongs "admin" user group  
  useradd user1 create a new user 
  userdel -r user1 delete a user ( '-r 'eliminates home directory) 
  the usermod -C "the FTP the user" System -d -g / FTP / user1 -s / bin / nologin user1 modify user attributes 
  passwd Change password 
  passwd user1 change a user password (only perform root)   LS -LH show permissions 

-------------------------------------------------- - 
  packaged and compressed files
  
  bunzip2 file1.bz2 decompression called 'file1.bz2' file 
  compression called bzip2 file1 'file1' files 
  gunzip file1.gz decompression called 'file1.gz' file 
  gzip file1 compress called 'file1 'file 
  gzip -9 file1 maximize compression 
  rar a file1.rar test_file created called' file1.rar 'package 
  rar a file1.rar file1 file2 dir1 while compressing' file1 ',' file2 'and the directory' dir1 ' 
  RAR the X- packet decompression file1.rar rar 
  unrar x file1.rar packet extracting rar 
  tar -cvf archive.tar file1 create a non-compressed the tarball 
  tar -cvf archive.tar file1 file2 dir1 created containing a 'file1', 'file2' and 'dir1 'archive 
  tar -tf archive.tar display the contents of a package 
  tar -xvf archive.tar release a package  
  tar -xvf archive.tar -C / tmp to release the compressed packet / tmp catalog 
  tar -cvfj archive.tar.bz2 dir1 create a bzip2 format archive 
  tar -jxvf archive.tar.bz2 extracting archive a bzip2 format of 
  tar -cvfz archive.tar.gz dir1 create a compressed gzip format 
  tar -zxvf archive.tar.gz decompress a gzip format compressed 
  zip file1.zip file1 create a zip format compressed 
  zip -r file1.zip file1 file2 dir1 several files and directories simultaneously compressed into a zip archive format 
  unzip file1 .zip extracting a compressed zip format
-------------------------------------------------- - 
  Look at the file
  content cat file1 view forward from the first byte of the file 
  tac file1 view a file in reverse, starting from the last line 
  more file1 view the contents of a long file of 
  less file1 similar to 'more' command but it allows operation of the same file, and the forward reverse operation of 
   the first two rows of the head to view a file file1 -2 
  tail -2 file1 view last two lines of a file 
  tail -f / var / log / messages are added to a live view the contents of the file 
-------------------------------------------------- - 
  text processing 
  CAT file1 file2 ... | the Command <> file1_in.txt_or_file1_out.txt General Manipulation text syntax for a using PIPE, STDIN and STDOUT 
  CAT file1 | the Command (sed, grep, awk, grep, etc ...)> the Result. txt file merge a detailed description of the text, and write a new introduction file 
  cat file1 | command (sed, grep , awk, grep, etc ...) >> result.txt merger described in detail a text file, and the introduction written an existing file 
  grep Aug / var / log / messages will search for "Aug" on file '/ var / log / messages' in 
  grep ^ Aug / var / log / messages in the file' / var / log / messages' to find word "Aug" starting 
  grep [0-9] / var / log / messages select '/ var / log / messages' file contains the numbers of all the rows 
  grep Aug -R / var / log / * Search the directory '/ var / log' directory and subsequent string "-Aug" 
  Sed 'S / stringa1 / stringa2 / G' example.txt in example.txt of "string1" replaced with "string2"
  sed '/ ^ $ / d' example.txt delete all files from example.txt blank lines 
  sed '/ * # / d; / ^ $ / d' example.txt removes all comments and blank lines from a file example.txt 
  echo 'esempio' | tr '[ : lower:]' '[: upper:]' vertical merged cell contents 
  sed -e '1d' result.txt excluded from the first line of the file example.txt 
  sed -n '/ stringa1 'view only lines containing words "string1" a / the p- 
  sed -e' S / * $ // 'delete example.txt end of each row of white space character 
  sed -e' s / stringa1 // g 'example.txt from the document delete only the words "string1" and retain all remaining 
  sed -n '1,5p; 5q' example.txt view the contents of the fifth line from the first line to the 
  sed -n '5p; 5q' example.txt View 5th row 
  sed - e 's / 00 * / 0 / g' replaced with a single zero example.txt more zero 
  cat -n file1 file designated number of lines 
  cat example.txt | awk 'NR% 2 == 1' delete file example.txt all the even lines 
  echo abc | awk ' {print $ 1} 'view the first column line
  echo abc | awk' {print $ 1, $ 3} ' view the first and the third column line 
  paste file1 file2 two files or merge the contents of two columns 
  paste -d '+' file1 file2 merging contents of two files or two columns, with the intermediate "+" to distinguish 
  two files sort file1 file2 sort 
  sort file1 file2 | uniq remove the two files and set (only one copy of duplicate rows) 
  the Sort file1 file2 | uniq -u files by viewing only unique line 
  sort file1 file2 | uniq -d sort contents of two files (only duplicate two files in the file) 
  content comm -1 file1 file2 compare two files to delete only content 'file1' contained 
  comm content file1 file2 compare two files -2 only delete the contents 'file2' contained 
  comm - 3 file1 file2 compare contents of two files by deleting only partially common to both files

 

 

  

Guess you like

Origin www.cnblogs.com/sansheng93/p/learningLinux.html