Operation and Maintenance
Linux Operation and Maintenance
Programmers must master 59 commonly used Linux commandsThe content of this article is about 58 commonly used commands in Linux. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Quick start terminal: ctr alt t
Enlarge terminal font: ctr shift ' '
Terminal font reduction: ctr '-'
ls: View the file information of the current directory
pwd: View the path of the current directory
touch: Create file
mkdir: Create folder
rmdir: Delete empty folder
rm: Files are deleted by default. -r means to recursively delete all file information in the folder and finally delete the folder
cd Switch directory 10.1 cd directory name: Switch to the specified directory 10.2 cd ..: Switch to the upper level directory 10.3 cd .: Switch to the current directory 10.4 cd ~: Switch to the user's working directory 10.5 cd -=> cd ~ : Switch to the user's working directory 10.6 cd -: Switch to the last directory
clear :Clear screen->window : cls
Absolute path: The path starting from the root directory is called an absolute path -> cd /home/python
Relative path: The path starting from the current directory is called a relative path -> cd ../test cd ./test
Summary on the use of absolute paths and relative paths: If the directory being switched is close to the root directory, use the absolute path. If the directory being switched is close to the current directory, use the relative path. , if the directory being switched is not close to the current directory and the root directory, use the absolute path
cp: copy 15.1 cp file name path: copy the file to the specified directory 15.2 cp file name Path/new file name: Copy the file to the specified path and then modify it to the new file name 15.3 cp file name new file name: Copy the file to the current directory and modify it to the new file name 15.3 cp Folder path -r : Copy the folder to the specified path -r: Copy all the files in the folder recursively
mv: Move (cut) 16.1 mv file name path : Move the file to the specified directory 16.2 mv file name path/new file name: Move the file to the specified path and modify it to the new file name 16.3 mv file name new file name: Rename the 16.4 mv folder path: Move the folder to the specified path
tree: View directory information in the form of a directory tree 17.1 tree path: View directory tree information in the specified path
cal: View the current month calendar 18.1 cal -y: View the full year calendar information
date: View the current time 19.1 Time format: date " %Y-%m-%d %H:%M:%S": Year, month, day and ten seconds
history: View historical command 20.1! Historical command number: Execute the corresponding historical command
Command format: 21.1 Command name options parameters, prompt options can sometimes be placed after the parameters, but if an error is reported, you can consider placing them after the command, such as: scp -r 21.2 Options: For example: -r, The options may have 0 or more 21.3 Parameters: file name or path, the parameters may have 0 or more
Command name --help: View help information
man Command name: View help information 23.1 f Space: View next page 23.2 b: View previous page 23.3 Enter: View next line 23.4 q: Exit
rm: Option 24.1 -i: Reminder before deletion 24.2 -r: Recursively delete all file information in the folder 24.3 -f: If the file does not exist, no error message is displayed when deleting 24.4 -v: Display deletion description information 24.5 -d: Delete empty directory
ls option 25.1 -l: Display in list form 25.2 -a: Display hidden files 25.3 - h: Display file size unit
- ##ll -> ls -al
- l -> ls
- mkdir options: 28.1 -p: Create the required folders in advance
- cp options 29.1 -i: Display reminder 29.2 -r: Recursively Copy the folder 29.3 -f: Direct overwrite 29.4 -v: Display the copied path description
- mv options: 30.1 -i: Display reminder 30.2 -f: Direct overwrite 30.3 -v: Display the moved path description
- Redirection (>,>>): Rewrite the specified display direction, save the data displayed on the terminal to a file, and view the data later View through files 31.1 >: If the file exists, the original data will be cleared first and then new data will be written, which is equivalent to file operation: w 31.2 >>: If the file exists, then it will be performed based on the original data. Append writing data is equivalent to file operation: a Summary: ls, tree, cat collection redirection uses
- gedit: command of text editing tool, readable and writable
- cat: View the data in the file in the terminal, read-only
- more: Split screen display 34.1 f (space): See the next page 34.2 b: Look at the previous page 34.3 Enter: Look at the next line 34.4 q: Exit
- | Pipeline: Can be understood as a container for data 35.1 Note: You cannot look at the previous page when using the pipe in combination with more Page: b shortcut key does not work 35.2 ls, tree cat can be used in combination with pipes
- File merging 36.1 cat 1.txt 2.txt > 3.txt
Link: Soft link: Just like a shortcut, note: deleting the original file soft link is invalid, creating a soft link will not increase the number of hard links by 1, you can create a soft link in a directory. Very important note Point: If the soft link is not in the same directory as the original file, then the original file needs to use the absolute path of the soft link: ln -s 1.txt 1-s.txt, ln -s /home/python/Desktop/AAA /1.txt ../1-s.txt By default, search
-
in the current directory
Hard link: Just like a person can have multiple names, deleting the original file will not affect the hard link file. File data can still be obtained using hard link files. Note: Hard links cannot be created for directories. Creating a hard link can only be created for files. Creating a hard link will increase the number of hard links by 1. Use of hard links: ln 1.txt 1-h.txt
grep: Find data based on search content 38.1 -n: Display line number 38.2 -v: Negate based on search content 38.3 -i: Ignore case
find: Search for files based on the specified path 39.1 -name: Search based on the file name 39.2 -size: Search based on the file size, please note that it is not accurate and generally not used 39.3 -perm: Search based on permissions r:4 w:2 x:1 find . -name "*.txt" -> Search for files with .txt suffix. Wildcard: plays the role of fuzzy query, * means matching 0 or more characters, ?: can only match any character, Tip: Wildcards have nothing to do with regular expressions
ls. Use it in combination with wildcards. For example: ls *.txt
- ##tar to package 41.1 tar -cvf test .tar *.txt -> test.tar package, please note that the space will not become smaller because it is not compressed
- gzip compression 42.1 gzip test.tar -> test.tar.gz Compressed package, the space will become smaller
- tar packaging and compression (must master) 43.1 tar -zcvf test.tar.gz *.txt -> test.tar.gz compressed package 43.2 -z: Compression -c: Packaging -v: Display the packaged file f: Specify the file name
- gzip Decompress 44.1 gzip -d test.tar.gz -> test.tar package
- tar Unpack 45.1 tar -xvf test.tar -> Files in the package 45.2 -x: Unpack
- tar Unpack and unpacking (must master) 46.1 tar -zxvf test.tar.gz -> Decompress and unpack the file 46.2 tar -zxvf test.tar.gz -C path -> Decompress and unpack the compressed package to the specified path
- bz2 Pack and compress -jcvf test.bz2 *.txt -> test.bz2
- bz2 Unzip and unpack 48.1 tar -jxvf test.bz2 -> Get the file 48.2 in the compressed package tar -jxvf test.bz2 -C path -> Decompress and unpack the compressed file to the specified path
- zip packaging and compression 49.1 zip test[.zip optional] *.txt -> test.zip
- unzip decompression and unpacking 50.1 unzip test.zip -> get the solution Compressed and unpacked files 50.2 unzip test.zip -d path -> Decompress and unpack to the specified path 50.3 Summary: zip compressed packages take up the largest space, and generally use .gz and bz2
- chmod: Modify file permissions 51.1 User role: u: Current user g: User in the same group o: Other users a: All users 51.2 Permissions: r(4): Readable w(2): Writable x( 1): Executable - (0): No permission 51.3 chmod a=rwx 1.txt, chmod a=- 1.txt, chmod a= 1.txt, chmod 777 1.txt chmod 000 1.txt 51.4 Different users are different Permissions: chmod u=r,g=w,r=rwx 1.txt, chmod 427 1.txt
- cp option-a: retain file permissions, mainly for other users Permissions, Tip: -a contains the -r option, you can also copy the folder
- which: Get the path of the command
- sudo -s: Switch to the administrator user
- whoami: current user
- who: those users currently logged in
- passwd:Change password
- exit:Exit account
The above is the detailed content of Programmers must master 59 commonly used Linux commands. For more information, please follow other related articles on the PHP Chinese website!
Linux Operations: System Administration and MaintenanceApr 15, 2025 am 12:10 AMThe key steps in Linux system management and maintenance include: 1) Master the basic knowledge, such as file system structure and user management; 2) Carry out system monitoring and resource management, use top, htop and other tools; 3) Use system logs to troubleshoot, use journalctl and other tools; 4) Write automated scripts and task scheduling, use cron tools; 5) implement security management and protection, configure firewalls through iptables; 6) Carry out performance optimization and best practices, adjust kernel parameters and develop good habits.
Understanding Linux's Maintenance Mode: The EssentialsApr 14, 2025 am 12:04 AMLinux maintenance mode is entered by adding init=/bin/bash or single parameters at startup. 1. Enter maintenance mode: Edit the GRUB menu and add startup parameters. 2. Remount the file system to read and write mode: mount-oremount,rw/. 3. Repair the file system: Use the fsck command, such as fsck/dev/sda1. 4. Back up the data and operate with caution to avoid data loss.
How Debian improves Hadoop data processing speedApr 13, 2025 am 11:54 AMThis article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file
How to learn Debian syslogApr 13, 2025 am 11:51 AMThis guide will guide you to learn how to use Syslog in Debian systems. Syslog is a key service in Linux systems for logging system and application log messages. It helps administrators monitor and analyze system activity to quickly identify and resolve problems. 1. Basic knowledge of Syslog The core functions of Syslog include: centrally collecting and managing log messages; supporting multiple log output formats and target locations (such as files or networks); providing real-time log viewing and filtering functions. 2. Install and configure Syslog (using Rsyslog) The Debian system uses Rsyslog by default. You can install it with the following command: sudoaptupdatesud
How to choose Hadoop version in DebianApr 13, 2025 am 11:48 AMWhen choosing a Hadoop version suitable for Debian system, the following key factors need to be considered: 1. Stability and long-term support: For users who pursue stability and security, it is recommended to choose a Debian stable version, such as Debian11 (Bullseye). This version has been fully tested and has a support cycle of up to five years, which can ensure the stable operation of the system. 2. Package update speed: If you need to use the latest Hadoop features and features, you can consider Debian's unstable version (Sid). However, it should be noted that unstable versions may have compatibility issues and stability risks. 3. Community support and resources: Debian has huge community support, which can provide rich documentation and
TigerVNC share file method on DebianApr 13, 2025 am 11:45 AMThis article describes how to use TigerVNC to share files on Debian systems. You need to install the TigerVNC server first and then configure it. 1. Install the TigerVNC server and open the terminal. Update the software package list: sudoaptupdate to install TigerVNC server: sudoaptinstalltigervnc-standalone-servertigervnc-common 2. Configure TigerVNC server to set VNC server password: vncpasswd Start VNC server: vncserver:1-localhostno
Debian mail server firewall configuration tipsApr 13, 2025 am 11:42 AMConfiguring a Debian mail server's firewall is an important step in ensuring server security. The following are several commonly used firewall configuration methods, including the use of iptables and firewalld. Use iptables to configure firewall to install iptables (if not already installed): sudoapt-getupdatesudoapt-getinstalliptablesView current iptables rules: sudoiptables-L configuration
Debian mail server SSL certificate installation methodApr 13, 2025 am 11:39 AMThe steps to install an SSL certificate on the Debian mail server are as follows: 1. Install the OpenSSL toolkit First, make sure that the OpenSSL toolkit is already installed on your system. If not installed, you can use the following command to install: sudoapt-getupdatesudoapt-getinstallopenssl2. Generate private key and certificate request Next, use OpenSSL to generate a 2048-bit RSA private key and a certificate request (CSR): openss


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools

Dreamweaver CS6
Visual web development tools





