Commonly used operating commands in linux
Introduction to Linux and Ubuntu installation
Linux, free and open source, multi-user and multi-tasking system. There are multiple versions based on Linux. RedHat, Ubuntu, Debian
Install VMware or VirtualBox virtual machine. For specific installation steps, please find Baidu.
Then install Ubuntu. For specific installation steps, please find Baidu.
After installation, you can see the directory structure of the Linux system.
Common commands
ls Display files or directories
-l List file details l(list)
-a List all files and directories in the current directory, including hidden a(all)
mkdir Create directory
-p Create a directory, if there is no parent directory, create it P (Parent)
CD Switch Catalog
Touch Create empty files
# Echo Create a file with content.
cat ous ous d ient ous Recursive deletion can Delete subdirectories and files
-f - - ‐ ’ s ’ s ’ s ’ ’ ’ ’ history with with with with with with with with 2 Number
GREP Find a string in the text file
# RMDIR to delete the empty directory
TREE tree structure display directory. PWD display current directory
Ln Create link files
# More, LESS pages display text file content # Head, tail display file header, tail content
Ctrl +alt+F1 Command line full screen mode
System management command
stat Display detailed information of the specified file, more detailed than ls
who Display online Login user
Whoami Show the current operating user
# Hostname display host name
# UNAME display system information
TOP dynamic display currently consume the most current process information
#ps Disk informationifconfig # Man ls Clear Clear the screen # Alias renamed the command, such as: Alias Showmeit = "PS -AUX". First use the ps or top command to check the ID of the process, and then use the kill command to kill the process. # Packing and compressed related commands # GZIP: BZIP2:
## Tar: Packing compression
##- Archive file -x Compressed file -z gzip compressed file -j bzip2 compressed file -v -v Display the compression or decompression process v( view) Use the file name Example: tar -cvf /home/abc.tar /home/abc View)tar -zcvf /home/abc.tar.gz /home/abc Packed and compressed with gzip
tar -jcvf /home/abc.tar.bz2 /home/abc Packed and compressed with bzip2
Of course, if you want to decompress, just replace the "c" in the above command tar -cvf / tar -zcvf / tar -jcvf with "x".
Shut down/restart the machine
shutdown
-r Shut down and restart
-h Shut down without restarting
now Shut down immediately
halt Shut down
reboot Restart
Linux pipe
Use the standard output of one command as the standard output of another command standard input. That is to say, several commands are used in combination, and the result of the latter command is divided by the previous command.
Example: grep -r "close" /home/* | more Search all files in the home directory, including close files, and output them in pages.
Linux software package management
dpkg (Debian Package) management tool, the software package name has the .deb suffix. This method is suitable when the system cannot be connected to the Internet.
For example, to install the installation package of the tree command, first transfer tree.deb to the Linux system. Then use the following command to install.
sudo dpkg -i tree_1.5.3-1_i386.deb Install software
sudo dpkg -r tree Use use dpkg through using - There are many ways to transfer it to the Linux system. VMwareTool, use mounting method; use winSCP tool, etc.;
APT (Advanced Packaging Tool) advanced software tool. This method is suitable if the system can connect to the Internet.
Still taking tree as an example
sudo apt-get install tree use using ’ ‐ ’ s ‐ ‐ ‐ ‐ ‐ t-get to Update software
sudo apt-get upgrade
Convert .rpm file to .deb file
.rpm is the software format used by RedHat. It cannot be used directly under Ubuntu, so it needs to be converted.
sudo alien abc.rpm
vim uses
vim three modes:
command mode, insert mode,
EditMode. Use ESC or i or : to switch modes.
command mode:
: q exit : q! Mandatory exit ##: wq save and exit ##: Set Number Show line number
:set nonumber Hide line number
/apache Find apache in the document Press n to jump to the next one, shift+n to the previous one
yyp Copy the cursor location line, and paste
h (move one character left ←), j (next row ↓), k (previous row ↑), l (move right one character →)
User and user group management
/etc/passwd Storage of user accounts
/etc/group Storage of group accounts
/etc/shadow Storage of passwords for user accounts
/etc/gshadow stores the password of the user group account
useradd username
userdel username
adduser username
groupadd group Name
groupdel Group name
passwd root Set password for root
su root
su - root
/etc/profile System Environment variables
bash_profile User environment variables
.bashrc User environment variables
su user Switch users and load the
configuration file.bashrc
su - user Switch user, load configuration file /etc/profile, load bash_profile
Change the user and user group of the file
sudo chown [-R] owner[:group] {File| Directory}
For example: Take jdk-7u21-linux-i586.tar.gz as an example. Belongs to user hadoop, group hadoopTo switch the user and group to which this file belongs. Commands are available.
sudo chown root:root jdk-7u21-linux-i586.tar.gz
File
Permission management三Basic permissions
R Reading value is expressed as 4
# W. Write the value as 2
x The executable value can be represented as 1
Example of how to use inode to delete specified files under Linux
The file directory structure in Linux Detailed introduction
Detailed explanation of the pmap command for Linux performance testing
How to obtain the local source port number through socket communication in Linux
The above is the detailed content of Commonly used operating commands in linux. For more information, please follow other related articles on the PHP Chinese website!

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.
