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!

To protect the application from session-related XSS attacks, the following measures are required: 1. Set the HttpOnly and Secure flags to protect the session cookies. 2. Export codes for all user inputs. 3. Implement content security policy (CSP) to limit script sources. Through these policies, session-related XSS attacks can be effectively protected and user data can be ensured.

Methods to optimize PHP session performance include: 1. Delay session start, 2. Use database to store sessions, 3. Compress session data, 4. Manage session life cycle, and 5. Implement session sharing. These strategies can significantly improve the efficiency of applications in high concurrency environments.

Thesession.gc_maxlifetimesettinginPHPdeterminesthelifespanofsessiondata,setinseconds.1)It'sconfiguredinphp.iniorviaini_set().2)Abalanceisneededtoavoidperformanceissuesandunexpectedlogouts.3)PHP'sgarbagecollectionisprobabilistic,influencedbygc_probabi

In PHP, you can use the session_name() function to configure the session name. The specific steps are as follows: 1. Use the session_name() function to set the session name, such as session_name("my_session"). 2. After setting the session name, call session_start() to start the session. Configuring session names can avoid session data conflicts between multiple applications and enhance security, but pay attention to the uniqueness, security, length and setting timing of session names.

The session ID should be regenerated regularly at login, before sensitive operations, and every 30 minutes. 1. Regenerate the session ID when logging in to prevent session fixed attacks. 2. Regenerate before sensitive operations to improve safety. 3. Regular regeneration reduces long-term utilization risks, but the user experience needs to be weighed.

Setting session cookie parameters in PHP can be achieved through the session_set_cookie_params() function. 1) Use this function to set parameters, such as expiration time, path, domain name, security flag, etc.; 2) Call session_start() to make the parameters take effect; 3) Dynamically adjust parameters according to needs, such as user login status; 4) Pay attention to setting secure and httponly flags to improve security.

The main purpose of using sessions in PHP is to maintain the status of the user between different pages. 1) The session is started through the session_start() function, creating a unique session ID and storing it in the user cookie. 2) Session data is saved on the server, allowing data to be passed between different requests, such as login status and shopping cart content.

How to share a session between subdomains? Implemented by setting session cookies for common domain names. 1. Set the domain of the session cookie to .example.com on the server side. 2. Choose the appropriate session storage method, such as memory, database or distributed cache. 3. Pass the session ID through cookies, and the server retrieves and updates the session data based on the ID.


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

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

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