7 commands to manipulate the most basic files and folders everyone must know
On Windows or Linux operating systems, there are a number of things that users can only do with commands. In the following article, Network Administrator will introduce you to the 7 most basic Linux commands that any user must 'understand' to perform operations faster.
1. Change directory
Usually to change certain folders you will have to navigate through the directories. However on both Terminal and Command Prompt you can use the cd command to change your current directory to the destination to another folder.
Suppose if you want to access the tech directory, you only need to enter the command:
cd tech
Alternatively, you can navigate directly to the tech directory subdirectory, using the command:
cd tech / sub-folder
To return to the previous folder or return to the current directory, enter:
cd .
2. Create a new folder
mkdir is also one of the commands that users often use. This statement is used to create a new directory with a specific name.
For example, if you want to create a new directory called tech, use the following command:
mkdir tech
Also you can create multiple folders at once, for example if you want to create 3 folders named tech, hello and world at the same time, you use the command below:
mkdir tech hello world
The mkdir command is compatible with both Terminal and Command Prompt.
3. Create a new file
Use the touch command to create an empty file. Such as:
touch filename.html
In addition, you can specify multiple file names to create multiple files at once, such as:
touch file.html style.css
4. Move files
Use the mv command to move a specific file to a directory. For example, if you want to move the tech.css file to the directory named / sid, use the following command:
mv tech.css / sid
You can also use the mv command to change file names and directories. For example, if you want to rename index.html to about.html, use the following command:
mv index.html about.html
5. Copy files
Enter cp command or copy if you want to copy a file or a directory.
For example, if you want to copy index.html and name the new file about.html, use the following command:
cp index.html about.html
If you are using Windows operating system, you use the copy command.
6. Display folder contents
Use the List Directory command or the ls command to display the contents of a directory.
The specific name of the directory precedes the ls command to display the contents of the directory.
However, the drawback is that the ls command only works on UNIX Shell. You can run the ls command on Ubuntu and the OS X operating system that cannot run on Windows.
On Windows operating systems you can use the dir command instead.
7. Open the file
Use the open command to open the files of the directory in the default application. For example, to open the Desktop folder on the Finder, use the following command:
open ~ / Desktop
Also you can use the open command to open the .txt folder on TextEdit - the default application on OS X operating system to edit Plain text file, you use the following command:
open readme.txt
For Windows users, use the edit command. For example:
edit readme.txt
Additional:
- Alternatively, you can use the Exit command to exit the Command Prompt window.
- Use ipconfig command to quickly search your IP address.
Refer to some of the following articles:
- Common Run commands for Windows you should know
- Anyone should know these basic Linux commands
- Use the CMD command to remove viruses on Windows computers
Good luck
You should read it
- Basic Linux commands everyone needs to know
- Basic Shell commands in Linux
- Instructions for using zforce command on Linux
- Some basic Terminal commands in Linux Mint 11
- 20+ essential Linux security commands
- 14 interesting Linux commands in Terminal
- The Cat command in Linux
- How to use the which command in Linux
- How to run 2 or more Terminal commands at the same time on Linux
- How to use the history command in Linux
- How to use cURL command in Linux
- Cisco CCNA command synthesis
Maybe you are interested
What is a matrix in MATLAB? Commands and usage
How to use the file search command on Windows, find saved files
Why is tldr command better than man command in Linux?
Should I use PowerShell or Command Prompt?
What to do when open command window here does not appear?
How to switch users on the Linux command line