Zero-based entry required Linux commands and the C programming language

  Files and directories (bottom video data)

  cd / home enter '/ home' directory '

  cd ... go back one level

  cd ... / ... return to the two directories

  cd go to home directory

  cd ~ user1 go to home directory

  cd - returns the directory where the last

  pwd show the path of work

  ls view files in the directory

  ls -F view files in a directory

  ls -l show details of files and directories

  ls -a show hidden files

  ls [0-9] displays the file name and directory names that contain numbers

  and tree structure of the file tree display (1) starting from the root directory

  lstree and displays the file tree structure (2) starting from the root directory of the directory

  mkdir dir1 create a 'dir1' directory called '

  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 a 'dir1' directory called '

  rm -RF dir1 'dir1' delete directory called and delete its contents

  rm -rf dir1 dir2 remove two directories at the same time and their contents

  mv dir1 new_dir rename / move a directory

  cp file1 file2 copy a file

  cp dir / *. Copy all files in a directory under the current working directory

  cp -a / tmp / dir1. copy a directory to the current working 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

  touch -t 0712250000 file1 modify timestamp of a file or directory - (YYMMDDhhmm)

  file file1 outputs the mime type of the file as text

  iconv -l lists known encoding

  iconv -f fromEncoding -t toEncoding inputFile > outputFile creates a new from the given input file by assuming it is encoded in fromEncoding and converting it to toEncoding.

  find . -maxdepth 1 -name *.jpg -print -exec convert “{}” -resize 80x60 “thumbs/{}” ; batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)

  Mount a file system

  mount / dev / hda2 / mnt / hda2 mount a disk called hda2 - determining the directory '/ mnt / hda2' already exists

  umount / dev / hda2 disk unload called hda2 - start with the mount point '/ mnt / hda2' exit

  fuser -km / mnt / hda2 force umount when the device is busy

  umount -n / mnt / hda2 run umount without writing / etc / mtab file - if the file is read-only or very useful when the disk is full

  mount / dev / fd0 / mnt / floppy mount a floppy

  mount / dev / cdrom / mnt / cdrom mount a cdrom or dvdrom

  mount / dev / hdc / mnt / cdrecorder or mount a cdrw dvdrom

  mount / dev / hdb / mnt / cdrecorder or mount a cdrw dvdrom

  mount -o loop file.iso / mnt / cdrom mount an ISO image file or

  mount -t vfat / dev / hda5 / mnt / hda5 mount a Windows FAT32 file system

  mount / dev / sda1 / mnt / usbdisk mount a pen-drive or flash usb

  mount -t smbfs -o username = user, password = pass // WinClient / share / mnt / share mount a windows network share

  system message

  arch show architecture of machine (1)

  uname -m show architecture of machine (2)

  uname -r to display the kernel version being used

  dmidecode -q show hardware system components - (SMBIOS / DMI)

  hdpARM -i / dev / hda listed architectural features of a disk

  hdparm -tT / dev / sda perform a test of a read operation on the disk

  cat / proc / cpuinfo CPU info display information to

  cat / proc / interrupts show interrupts

  cat / proc / meminfo verify memory use

  cat / proc / swaps display which is used swap

  cat / proc / version show version of the kernel

  cat / proc / net / dev show network adapter and statistics

  cat / proc / mounts show mounted file system

  lspci -tv list PCI devices

  lsUSB -tv show USB devices

  date Display System Date

  cal 2007 show the 2007 calendar

  date 041217002007.00 set date and time - month, day, hour in seconds

  The time clock -w save changes to BIOS

  Shutdown (shutdown of the system, restart and logout)

  shutdown -h now shut down the system (1)

  init 0 Close system (2)

  telinit 0 Close system (3)

  shutdown -h hours: minutes & shutdown of the system time

  shutdown -c cancel off the system at a predetermined time

  shutdown -r now reboot (1)

  reboot reboot (2)

  logout logout file search

  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 * .bin in the directory '/ home / user1' search for files that end with '.bin'

  find / usr / bin -type f -atime +100 searched in the past 100 days has not been used to perform file

  find / usr / bin -type f -mtime -10 search is created or modified files within 10 days

  find / -name * .rpm -exec chmod 755 '{}'; search files ending in '.rpm' and define permissions

  find / -xdev -name * .rpm search files ending in '.rpm', ignoring drive, a removable disk device, Czech Republic

  locate * .ps find the end with '.ps' document - first run 'updatedb' command

  whereis halt show location of a binary file, source or man of

  which halt show full path to a binary file or executable file

  disk space

  df -h Displays a list of partitions are mounted

  ls -lSr | more aligned to the size of the files and directories

  du -sh dir1 estimate disk space directory 'dir1' already used '

  du -sk * | sort -rn capacity to turn the display size based on the size of files and directories

  rpm -q -a --qf '% 10 {SIZE} t% {NAME} n' | sort -k1,1n sequentially displayed by size space (fedora, redhat based system) installed rpm packages used

  dpkg-query -W -f = 'InstalLED-Size; 10t {InstalLED-Size; 10} tInstalLED-Size; 10t {Package} n' | sort -k1,1n by size displays installed deb packages used space (ubuntu, debian based systems)

  Users and Groups

  groupadd group_name create a new user group

  groupdel group_name delete a user group

  groupmod -n new_group_name old_group_name rename a user group

  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)

  usermod -c "User FTP" -g system -d / ftp / user1 -s / bin / nologin user1 Modify User Attributes

  passwd change password

  passwd user1 change a user password (only perform root)

  chage -E 2005-12-31 user1 set deadline invalid user password

  pwck Check '/ etc / passwd' correct syntax and file format and presence of the user

  grpck Check '/ etc / passwd' correct syntax and format file group and present

  newgrp group_name log into a new group to change default group of newly created files

  File permissions - using the "+" to set permissions, use the "-" is used to cancel

  ls -lh Show Permissions

  ls / tmp | pr -T5 -W $ COLUMNS divide terminal into 5 columns display

  Permissions chmod ugo + rwx directory1 set the directory owner (u), group (g) and others (o) to read (r), write (w) and execute (x) of

  chmod go-rwx directory1 delete a group (g) and others (o) to read and write execute permissions on the directory

  chown user1 file1 change owner of a file's properties

  chown -R user1 directory1 change all attributes of a directory and simultaneously change the properties of all files in the directory change

  Groups chgrp group1 file1 change file

  chown user1: group1 file1 change user and group ownership of a file

  find / -perm -u + s list of all uses a file system control SUID

  chmod u + s / bin / file1 set SUID bit on a binary file - the user running the file and are each assigned to the same owner permissions

  chmod us / bin / file1 disable SUID bit on a binary file

  chmod g + s / home / public set SGID bit on a directory - similar to SUID, but this is for the directory

  chmod gs / home / public disable SGID bit on a directory

  chmod o + t / home / public set a STIKY bit files - delete files allow only legitimate owners

  chmod ot / home / public disable a catalog of STIKY bit

  Special Attributes on files - using the "+" to set permissions, use the "-" is used to cancel

  chattr + a file1 append mode allows only read and write files

  chattr + c file1 file by the kernel allows this automatic compression / decompression

  chattr + d file1 when performing file system backup, dump will ignore the file

  chattr + i file1 an immutable file can not be deleted, modified, or renaming Links

  chattr + s file1 allows a file to be safely deleted

  chattr + S file1 Once the application has been written to this file, the system immediately changes the result to disk

  chattr + u file1 If the file is deleted, the system will allow you to recover the contents of a file is deleted

  lsattr display special attributes

  Archives and compressed files

  bunzip2 file1.bz2 decompression called 'file1.bz2' files

  bzip2 file1 compression called 'file1' files

  gunzip file1.gz decompression called 'file1.gz' files

  gzip file1 compression called 'file1' files

  gzip -9 file1 maximum degree of compression

  rar a file1.rar test_file create called 'file1.rar' package

  rar a file1.rar file1 file2 dir1 while compressing 'file1', 'file2', and directory 'dir1'

  packet decompression rar rar x file1.rar

  packet decompression rar unrar x file1.rar

  tar -cvf archive.tar file1 create a uncompressed tarball

  tar -cvf archive.tar file1 file2 dir1 create a containing '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 release the compressed packet to the / tmp directory

  tar -cvfj archive.tar.bz2 dir1 create a bzip2 compressed format

  tar -xvfj archive.tar.bz2 decompressing a compressed format bzip2

  tar -cvfz archive.tar.gz dir1 create a compressed gzip format

  tar -xvfz archive.tar.gz decompressing a compressed gzip format

  zip file1.zip file1 create a zip archive format

  zip -r file1.zip file1 file2 dir1 several files and directories at the same time compressed into a compressed zip format

  unzip file1.zip decompressing a compressed zip format

  RPM package - (Fedora, Redhat and similar systems)

  rpm -ivh rpm package mounting a package.rpm

  rpm -ivh --nodeeps package.rpm install a rpm package while ignoring dependencies

  rpm -U package.rpm upgrade a rpm package without changing its configuration file

  rpm -F package.rpm update a determined rpm package installed

  rpm -e package_name.rpm remove a rpm package

  rpm -qa show all rpm packages already installed system

  rpm -qa | grep httpd show all the names included "httpd" word rpm package

  rpm -qi package_name obtain information on a specific package installed

  rpm -qg "System Environment / Daemons" show a package assembly rpm

  rpm -ql package_name display a list of files installed rpm package provides

  rpm -qc package_name show list of configuration files of an already installed rpm package provided

  rpm -q package_name --whatrequires rpm package displays a list of dependencies

  rpm -q package_name --whatprovides display a volume occupied rpm package

  rpm -q package_name --scripts displayed in the script l / deleted during the installation performed

  rpm -q package_name --changelog display modification history of a rpm package

  rpm -qf /etc/httpd/conf/httpd.conf to confirm the documents which rpm package consists of

  rpm -qp package.rpm -l displays a list of files provided by a rpm package not yet installed

  rpm --import / media / cdrom / RPM-GPG-KEY digital certificate of a public key

  rpm --checksig package.rpm confirm the integrity of a package rpm

  rpm -qa gpg-pubkey confirmed the integrity of all the packages installed rpm

  rpm -V package_name check file size, permissions, type, owner, group, MD5 checksum and last modification time

  rpm -Va inspection systems all installed rpm package - use caution

  rpm -Vp package.rpm a confirmation rpm package has not been installed

  rpm2cpio package.rpm | cpio --extract --make-directories bin executable file from a rpm package runs

  rpm -ivh /usr/src/redhat/RPMS/arch/package.rpm installed from a rpm source a package built

  rpmbuild --rebuild package_name.src.rpm construct a package from a rpm source rpm

  YUM packages updater - (Fedora, RedHat and similar systems)

  yum install package_name to download and install a package rpm

  yum localinstall package_name.rpm will install a rpm package, use your own software repository for you to solve all dependencies

  yum update package_name.rpm update all rpm packages installed in the current system

  yum update package_name upgrade a rpm package

  yum remove package_name remove a rpm package

  yum list lists all packages currently installed on the system

  yum search package_name search packages in the warehouse rpm

  yum clean packages to clean up rpm cache delete the downloaded package

  yum clean headers remove all header files

  yum clean all remove all cached packages and header files

  DEB package (Debian, Ubuntu and similar systems)

  dpkg -i package.deb install / upgrade a deb package

  dpkg -r package_name remove a deb package from the system

  dpkg -l show all deb packages already installed system

  dpkg -l | grep httpd show all deb package name contains "httpd" word

  dpkg -s package_name obtain information about a particular package is already installed in the system

  Dpkg -L package_name display a list of files already installed system provided a deb package

  dpkg --contents package.deb display a list of files in a package not yet installed the provided

  dpkg -S / bin / ping to confirm which documents provided by the deb package

  APT software tool (Debian, Ubuntu and similar systems)

  apt-get install package_name install / upgrade a deb package

  apt-cdrom install package_name installed from a CD / update a deb package

  apt-get update Upgrade Packages list

  apt-get upgrade upgrade all installed software

  apt-get remove package_name remove a deb package from the system

  apt-get check to confirm correct resolution of dependencies

  apt-get clean clean up cache from packages downloaded

  apt-cache search searched-package to return the package name that contains the search string

  View the file contents

  cat file1 view the contents of the file forward from the first byte

  tac file1 view the contents of a file in reverse, starting from the last row

  more file1 view the contents of a long document

  less file1 similar to 'more' command, but it allows operation in the file and forward the same reverse operation

  The first two lines of a file head -2 file1 view

  The last two lines of a file tail -2 file1 view

  tail -f / var / log / messages view in real time is added to the contents of a file

  CD

  cdrecord -v gracetime = 2 dev = / dev / cdrom -eject blank = fast -force empty a rewritable disc content

  mkisofs / dev / cdrom> cd.iso create a CD iso image file on disk

  mkisofs / dev / cdrom | gzip> cd_iso.gz create a compressed disk in the CD iso image file

  mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd create a directory iso image file

  cdrecord -v dev = / dev / cdrom cd.iso burn an ISO image file

  gzip -dc cd_iso.gz | cdrecord dev = / dev / cdrom - burn a compressed ISO image file

  mount -o loop cd.iso / mnt / iso mount an ISO image

  cd-paranoia -B transcription from a CD-ROM tracks to wav file

  cd-paranoia - "-3" transcribed from a CD-ROM tracks to wav file (parameter -3)

  cdrecord --scanbus scan bus to identify the channel scsi

  dd if = / dev / hdc | md5sum md5sum checking a coding device, for example a CD

  Character set and file format conversion

  dos2unix filedos.txt fileunix.txt to convert a text file format from MSDOS to UNIX

  unix2dos fileunix.txt filedos.txt the format is converted from a text file into a UNIX MSDOS

  recode ... HTML <page.txt> page.html convert a text file into html

  recode -l | more displays all format conversions allowed

  File System Analysis

  badblocks -v / dev / hda1 check bad blocks on the magnetic disk hda1

  fsck / dev / hda1 repair integrity / check linux filesystem on disk hda1

  fsck.ext2 / dev / hda1 repair integrity / check disk hda1 ext2 file system

  e2fsck / dev / hda1 repair integrity / check disk hda1 ext2 file system

  Integrity e2fsck -j / dev / hda1 repair / check ext3 filesystem on disk hda1

  fsck.ext3 / dev / hda1 repair integrity / check ext3 filesystem on disk hda1

  Integrity fsck.vfat / dev / hda1 repair / check fat filesystem on disk hda1

  fsck.msdos / dev / hda1 repair integrity / examination dos filesystem on disk hda1

  Integrity dosfsck / dev / hda1 repair / check dos filesystem on disk hda1

  A file system initialization

  mkfs / dev / hda1 create a filesystem on hda1 partition

  mke2fs / dev / hda1 create a filesystem type linux ext2 on hda1 partition

  mke2fs -j / dev / hda1 create a linux ext3 (journaling) file system partition hda1

  mkfs -t vfat 32 -F / dev / hda1 create a FAT32 file system

  fdformat -n / dev / fd0 a formatted floppy disk

  mkswap / dev / hda3 create a swap file system

  SWAP file systems

  mkswap / dev / hda3 create a swap file system

  swapon / dev / hda3 enable a new swap file system

  swapon / dev / hda2 / dev / hdb3 enable the two swap partitions

  Backup

  Full backup dump -0aj -f /tmp/home0.bak / home make a '/ home' directory

  Interactive backup dump -1aj -f /tmp/home0.bak / home make a '/ home' directory

  restore -IF /tmp/home0.bak restore a backup interactive

  rsync -rogpav --delete / home / tmp directory synchronization sides

  rsync -rogpav -e ssh --delete / home ip_address: / tmp passage through SSH rsync

  rsync -az -e ssh --delete ip_addr: / home / public / home / local ssh by compressing a remote directory and synchronized to a local directory

  rsync -az -e ssh --delete / home / local ip_addr: / home / public via ssh and compression to a local directory to a remote directory synchronization

  dd bs = 1M if = / dev / hda | gzip | ssh user @ ip_addr 'dd of = hda.gz' ssh by performing backup operations on a remote host a local disk

  dd if = / dev / sda of = / tmp / file1 backup disk contents to a file

  tar -Puf backup.tar / home / user to perform a backup operation for interactive '/ home / user' directory

  (Cd / tmp / local / && tar c.) | Ssh -C user @ ip_addr 'cd / home / share / && tar x -p' copy the contents of a directory on remote directory via ssh

  (Tar c / home) | ssh -C user @ ip_addr 'cd / home / backup-home && tar x -p' copy a local directory on remote directory via ssh

  tar cf - |. (cd / tmp / backup; tar xf -) local copy a directory to another, preserving permits and links

  find / home / user1 -name '.txt' | xargs cp -av --target-directory = / home / backup / --parents to find and copy all '.txt' file that ends from one directory to another directory

  find / var / log -name '.log' | tar cv --files-from = - | bzip2> log.tar.bz2 find all '.log' end of the document and make a packet bzip

  dd if = / dev / hda of = / dev / fd0 bs = 512 count = 1 to make a copy MBR (Master Boot Record) to floppy of

  dd if = / dev / fd0 of = / dev / hda bs = 512 count = 1 resume MBR from backup copy saved to floppy disk in

  Text Processing

  cat file1 file2 … | command <> file1_in.txt_or_file1_out.txt general syntax for text manipulation using PIPE, STDIN and STDOUT

  cat file1 | command (sed, grep, awk, grep, etc ...)> result.txt merge a text file detailed description, and the introduction writes a new file

  cat file1 | details text command (sed, grep, awk, grep, etc ...) >> result.txt merge a file and write a brief introduction existing file

  grep Aug / var / log / messages in the file '/ var / log / messages' Find keywords "Aug"

  grep ^ Aug / var / log / messages in the file '/ var / log / messages' to find "Aug" vocabulary begins

  grep [0-9] / var / log / messages select '/ var / log / messages' file numbers of all lines contained

  grep Aug -R / var / log / * search string "Aug" in the directory '/ var / log' directory and subsequent

  sed 's / stringa1 / stringa2 / g' example.txt in example.txt the "string1" replace "string2"

  sed '/ ^ KaTeX parse error: Expected' EOF ', got' # 'at position 49: ... any blank lines sed' / * # / d; / ^ / d 'example.txt delete all files from example.txt comments and blank lines

  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 / p' view only contains words "string1" row

  sed -e 's / $ //' example.txt delete the end of each row of blank characters

  sed -e 's / stringa1 // g' example.txt only delete words "string1" from the document and retain all remaining

  sed -n '1,5p; 5q' example.txt view the content from the first row of row 5

  sed -n '5p; 5q' example.txt View Line 5

  sed -e 's / 00/0 / g' replaced by a single multiple zero zero example.txt

  Cat -n file1 number of lines marked file

  cat example.txt | all even rows awk 'NR% 2 == 1' Delete file example.txt

  The first column awk '{print $ 1}' view line | echo abc

  echo abc | awk '{print $ 1, $ 3}' view the first and third column line

  paste file1 file2 merging contents of two files or two columns

  paste -d '+' file1 file2 merging contents of two files or two columns, with the intermediate "+" to distinguish

  The contents of two files sort file1 file2 sort of

  sort file1 file2 | uniq of two files and set (only one copy of duplicate rows)

  sort file1 file2 | uniq -u files by viewing only unique line

  sort file1 file2 | uniq -d sort contents of two files (leaving only the files that exist in both files)

  SUMMARY compare two comm -1 file1 file2 only delete the contents files 'file1' contained

  SUMMARY compare two comm -2 file1 file2 file delete only content 'file2' contained

  Content comm -3 file1 file2 compare two files by deleting only partially common to both files

 

Related videos like watching video away

Essential Linux commands and the C programming language
http://www.makeru.com.cn/video/1862.html?s=45051

C language programming foundation
http://www.makeru.com.cn/course/details/2233?s=45051
enhance the C programming ability
http://www.makeru.com.cn/live/1392_1166.html?s=45051

Fun C language list
http://www.makeru.com.cn/live/1392_338.html?s=45051

They can add learning exchange group: 830 802 928

Guess you like

Origin www.cnblogs.com/923327iu/p/12065831.html