7 Ways to Create a File through Linux Terminal Ankit Chaubey, 17, June 202218, June 2022 In this article, I will show you how to create a file through Linux terminal.TABLE OF CONTENTS0.1 1. Create a file with echo command0.2 2. Create a file with touch command0.3 3. Create a file with cat command0.4 4. Create a file with printf command0.5 5. Create a file with vi text editor0.6 6. Create a file with nano text editor0.7 7. Create a file with vim text editor1 Conclusion2 About The Author2.1 Ankit Chaubey3 Related1. Create a file with echo commandWe will use echo command to create file, echo.txt file created in your current directory.$ echo "This file has been created with echo command" > echo.txtTo see the file,type command below.$ ls -l echo.txtoutput -rw-r--r--. 1 root root 0 Sep 4 08:06 echo.txtTo open the file, we will use cat command to open it.$ cat echo.txtoutput This file has been created with echo command2. Create a file with touch commandWe will use touch command to create file, touch.txt file created in your current directory.$ sudo touch touch.txt$ sudo touch touch.docxTo see the file type command below.$ ls -loutput -rw-r--r--. 1 root root 0 Sep 4 08:08 touch.docx -rw-r--r--. 1 root root 0 Sep 4 08:06 touch.txt3. Create a file with cat commandWe will use cat command to create file, cat.txt file created in your current directory.$ cat > cat.txtAdd the text below.This file has been created with cat commandTo save the file hit Ctrl + d, and to see the file type command below.$ ls -l cat.txtoutput -rw-r--r--. 1 root root 0 Sep 4 08:06 cat.txtTo open the file, we will use cat command to open it.$ cat cat.txtoutput This file has been created with echo command4. Create a file with printf commandWe will use printf command to create file, printf.txt file created in your current directory.$ printf "This file has been created with printf command" > printf.txtTo see the file type command below.$ ls -l printf.txtoutput -rw-r--r--. 1 root root 0 Sep 4 08:06 printf.txtTo open the file, we will use cat command to open it.$ cat printf.txtoutput This file has been created with printf command5. Create a file with vi text editorType command below and the text editor will open the file, and type i for insert mode.$ vi vi.txtAdd the text below.This file has been created with vi text editorTo save the file and exit hit Esc after that :wq, To see the file type command below.$ ls -l vi.txtoutput -rw-r--r--. 1 root root 0 Sep 4 08:06 vi.txtTo open the file, we will use vi command to open it.$ vi vi.txtoutput This file has been created with vi command6. Create a file with nano text editorWe will use nano command to create file, nano.txt file created in your current directory.$ nano nano.txtAdd the text below.This file has been created with nano text editorTo save the file type Ctrl + x and type y, to see the file type command below.$ ls -l nano.txtoutput -rw-r--r--. 1 root root 0 Sep 4 08:06 nano.txtTo open the file, We will use nano command to open it.$ nano nano.txtoutput This file has been created with nano command7. Create a file with vim text editorType command below and the text editor will open the file, and type i for insert mode.$ vim vim.txtAdd the text below.This file has been created with vim text editorTo save the file and exit hit Esc after that :wq, to see the file type command below.$ ls -l vim.txtoutput -rw-r--r--. 1 root root 0 Sep 4 08:06 vim.txtTo open the file, we will use vim command to open it.$ vim vim.txtoutput This file has been created with vim commandConclusionWe learned the different ways to create a file through Linux terminal. Hope you enjoyed reading.About The Author Ankit Chaubey See author's postsRelated Hacks Linux 7 Ways to Create a File through Linux TerminalCreate a file with cat commandCreate a file with echo commandCreate a file with nano text editorCreate a file with printf commandCreate a file with touch commandCreate a file with vi text editorCreate a file with vim text editorLinux
Android Most unsafe browser in 2022 with 303 vulnerabilities 12, October 202212, October 2022A new report has surfaced revealing that Google Chrome is the most vulnerable browser as of 2022 with a total of 303 vulnerabilities. This information is based on data from the VulDB vulnerability database and was gathered between January 1st and October 5th of 2022. Although this number seems high,… Read More
kali Linux DEDMAP: A Network Automation Tool Focused on Cyber-Security 3, September 20233, September 2023DEDMAP is a free and open-source utility that can be found on GitHub. It functions as a scanner, scanning domains and websites. DEDMAP is a robust, cross-platform scanning utility. DEDMAP is a port scanning programme that is very similar to nmap. It is written in the bash programming language. To… Read More
kali Linux How to Fix Bluetooth Not Working Problem in Kali Linux 16, July 202216, July 2022If you’re experiencing issues with your Bluetooth toggle button returning to Off, or not displaying anything inside the Bluetooth window, there are a few potential solutions. First, try restarting your device. If that doesn’t work, try resetting your network settings. If you’re still having issues,then try this.TABLE OF CONTENTS1 Enable/Activate… Read More