ubuntu shell bash productivity

1 ubuntu file directory

colour White blue Light blue green red yellow gray
computer Ordinary file table of Contents Link file executable file Compressed file Device file Other files
  1. etc configuration files and directories
    • / etc / crontab writes scripts or regularly runs some tasks, with timing settings
    • / etc / fstab Disk ID mounted by the system
    • / etc / passwd account passwords of all users
  2. proc (process) You can use the file name to view that
  3. lib Shared library files required by various programs
  4. opt (optional third-party software)
  5. boot (boot file, kernel)
    • /boot/grub/grub.conf or menu.lst is used to configure the boot loader.
    • / boot / vmlinuz, Linux kernel
  6. var is used to store many constantly changing files, logs, etc.
    • The / var / log directory contains log files and records of various system activities.
    • These documents are very important, and they should be monitored from time to time.
  7. tmp storage system and user temporary information
  8. usr files and directories directly related to system users local / cuda
  9. sbin: storage location of system commands

2 Explore ubuntu commonly used commands-short commands (can be connected)-full name can not be connected

1 commonly used

  • Find files exactly / find / home / henry / -name 1.txt
  • Find wildcards based on file name find / home / henry / -name python *
  • sudo find ./ -size 2M
  • sudo find ./ -size + 2M find greater than
  • whereis pip
    • pip: /home/henry/anaconda3/bin/pip
  • locate pip find in the database, update once a week
  • which pip search system command location
    • /home/henry/anaconda3/bin/pip
  1. date time
  2. cal calendar
  3. file name (view file type) /home/henry/.bashrc: ASCII text
  4. pwd :Print name of current working directory
  5. ls: List directory contents
  6. mv ab move, rename
  7. rm -r is recursive deletion, -f is mandatory
  8. ln link soft link (symbol link) ln -s item link

2 text processing

  1. cat connects files and prints to standard output
    • cat -A print non-printable characters in text documents
    • cat -n increase line number in text
    • cat -s merge multiple blank lines 3 blank lines into one
    • Non-printing character name display effect
      • enter Enter key $
      • tab tab ^ I
      • space
  2. sort sorts text lines and sends the results to standard output
    • View the size sorting of folders du -s / usr / share / * | sort -nr | head
  3. uniq report or omit duplicate lines
    • uniq -c outputs all repeated lines, and the number of repeats is displayed at the beginning of each line
    • uniq -d output only duplicate lines
  4. cut slice
    • cut -f 2,2 linux-by-date.txt> linux-vernums.txt cut, take the east from the file
  5. paste merge
    • Merge file text lines, by reading multiple files, and then integrating the fields in each file into a single text stream, input to standard output.
    • paste linux-dates.txt linux-names.txt>linux-key-names.txt
  6. join to put things in the file
  7. Compare text:
    • comm compares two ordered files line by line
    • diff Compare files or directories line by line diff -Naur old_file new_file> patchfile.txt
    • patch applies the changes to the original document to patch <patchfile.txt

3 permissions

  1. ID
  2. chmod Change a fileʼs mode Change the existing file mode octal or symbolic representation
  3. umask: Set the default permissions for newly created files
  4. chown: Change a fileʼs owner
  5. su runs the shell as another user
  6. sudo executes a command with another identity
  7. passwd

4 Software installation management

The core of ubuntu's competing version is: package management, supporting community persistence,
most of which are updated every 6 months
and each individual program is updated daily

  1. Early liuxn users install software source code + compile opencv caffe

    • New build folder cmake ... (omit if there is a makefile directly) make -j8, make install
  2. Download the pre-compiled software package now.
    Having access to the software source code is the great thing about Linux. It gives everyone the right to customize and optimize the system.

    Value system Low-level tools Upper tools
    .deb Debian , Ubuntu dpkg apt-get, aptitude
    .rpm Fedora , CentOS , Red Hat , OpenSUSE rpm rpm
  3. Find the installation command subcommand package name apt install git The
    apt command first analyzes the git dependency, which is the benefit of package management. If the program finds that a dependency is missing, it will report an error and exit.

  4. Uninstall apt remove git y

  5. apt update update source

  6. Update installed package command subcommand package name apt upgrade git

  7. apt-cache show firefox Display detailed information of the package

Published 63 original articles · praised 7 · views 3396

Guess you like

Origin blog.csdn.net/weixin_44523062/article/details/105309261