How to create files in linux
How to create files in Linux: 1. Use the touch method, the code is [touch yy..]; 2. Use vi and vim, the code is [vi test.txt]; 3. Use [>, >>], the code is [> test.ini]; 4. Use cp to create the file; 5. Use cat to create the file.
The operating environment of this tutorial: linux7.3 system, DELL G3 computer.
How to create a file in Linux:
1, touch
1.1 Create a file
touch yyTest.ini
1.2 Create two files at the same time
touch test1.txt test2.txt
1.3 Create files in batches (such as creating 2000 files)
touch test{0001..2000}.txt
1.4 Change the time of the file yyTest.ini to the current time (yyTest.ini already exists)
touch yyTest.ini
2. vi and vim
vi test.txt vim touch.txt
3. Use >, >>
##3.1 >Overwrite the original file directly without any prompt3.2 >>Append to the end of the original file without overwriting the content of the original file 3.3 Directly use > to create an empty file> test.ini3.4 ls creates a file (writes the result to a file)
ls > test.ini ls >> test.ini3.5 grep creates a file (writes the result to a file)
ps -ef | grep java >test.ini ps -ef | grep java >>test.ini3.6 echo creates a file (writes the result to a file)
echo $PATH > test.ini echo $PATH >> test.ini
4. Use cp to create a file
As long as the target file is a new file, the file is created, cp detailed command For interpretation, please see this blog post: https://www.cnblogs.com/poloyy/p/12514389.html5. Use cat to create files
5.1 Simple use >, >>cat > test.ini cat >> test.iniActually, > and >> are also practical, but one thing is different. After typing the above command, you will enter the editing mode of test.ini, and you can enter it directly. The content you want to write, finally press ctrl z to exit the edit mode and automatically save it 5.2 cat combined with eof
cat >> test.ini <eof can be used as a delimiter, and stop input when encountering the next delimiter ;The case is the same 5.3 cat combined with exit and eof are the same cat >> test.ini <Related learning recommendations: linux video tutorial
The above is the detailed content of How to create files in linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

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)

As a pioneer in the digital world, Bitcoin’s unique code name and underlying technology have always been the focus of people’s attention. Its standard code is BTC, also known as XBT on certain platforms that meet international standards. From a technical point of view, Bitcoin is not a single code style, but a huge and sophisticated open source software project. Its core code is mainly written in C and incorporates cryptography, distributed systems and economics principles, so that anyone can view, review and contribute its code.

To enable PHP containers to support automatic construction, the core lies in configuring the continuous integration (CI) process. 1. Use Dockerfile to define the PHP environment, including basic image, extension installation, dependency management and permission settings; 2. Configure CI/CD tools such as GitLabCI, and define the build, test and deployment stages through the .gitlab-ci.yml file to achieve automatic construction, testing and deployment; 3. Integrate test frameworks such as PHPUnit to ensure that tests are automatically run after code changes; 4. Use automated deployment strategies such as Kubernetes to define deployment configuration through the deployment.yaml file; 5. Optimize Dockerfile and adopt multi-stage construction

Building an independent PHP task container environment can be implemented through Docker. The specific steps are as follows: 1. Install Docker and DockerCompose as the basis; 2. Create an independent directory to store Dockerfile and crontab files; 3. Write Dockerfile to define the PHPCLI environment and install cron and necessary extensions; 4. Write a crontab file to define timing tasks; 5. Write a docker-compose.yml mount script directory and configure environment variables; 6. Start the container and verify the log. Compared with performing timing tasks in web containers, independent containers have the advantages of resource isolation, pure environment, strong stability, and easy expansion. To ensure logging and error capture

Confirm the target hard disk device name (such as /dev/sda) to avoid accidentally deleting the system disk; 2. Use sudoddif=/dev/zeroof=/dev/sdXbs=1Mstatus=progress to overwrite the zero value in full disk, which is suitable for most scenarios; 3. Use sudoshred-v-n3/dev/sdX for three random data overwrites to ensure that it cannot be restored; 4. Optionally execute sudobadblocks-wsv/dev/sdX for destructive write tests; finally use sudohexdump-C/dev/sdX|head to verify whether it is all zero and complete safe erasing.

Windowsisbetterforbeginnersduetoeaseofuse,seamlesshardwarecompatibility,andsupportformainstreamsoftwarelikeMicrosoftOfficeandAdobeapps.2.LinuxoutperformsWindowsonolderorlow-resourcehardwarewithfasterboottimes,lowersystemrequirements,andlessbloat.3.Li

cronisusedforpreciseschedulingonalways-onsystems,whileanacronensuresperiodictasksrunonsystemsthataren'tcontinuouslypowered,suchaslaptops;1.Usecronforexacttiming(e.g.,3AMdaily)viacrontab-ewithsyntaxMINHOURDOMMONDOWCOMMAND;2.Useanacronfordaily,weekly,o

AfterinstallingLinux,thefirststepsincludeupdatingyoursystem,installingessentialsoftware,settingupbackupandsecuritymeasures,andcustomizingtheinterfacetosuityourpreferences.1)Updateyoursystemusingtheappropriatecommandforyourdistro(e.g.,sudoaptupdate&am

There are three main ways to install software on Linux: 1. Use a package manager, such as apt, dnf or pacman, and then execute the install command after updating the source, such as sudoaptininstallcurl; 2. For .deb or .rpm files, use dpkg or rpm commands to install, and repair dependencies when needed; 3. Use snap or flatpak to install applications across platforms, such as sudosnapinstall software name, which is suitable for users who are pursuing version updates. It is recommended to use the system's own package manager for better compatibility and performance.
