Linux commands are useful applications found in Linux. Commands may be used to do any simple or complicated activity. The commands are run using the Linux terminal. The terminal is a command-line interface for interacting with the system. It is similar to the Windows command prompt. Linux commands are case-sensitive. All of the commands below may be used to manipulate files and folders.
touch
- Use the “touch” command to create empty files.
- Use space between the file names to open multiple files using “touch” command.
touch elb.txt
![](https://elearnbee.com/wp-content/uploads/2023/10/Studio-Project1-6-1024x528.png)
cp
- To copy a file or directory, use the “cp” command
- To copy in the same directory, use the command:
cp file_to_copy.txt new_name.txt
- To copy in a different directory, use the command:
cp file_to_copy destination_path_of_the_directory
- To copy a directory inside another directory, use the command:
cp -r directory_to_copy/ destination_path__the_directory/
Here “r” stands for recursively (Note: to learn use of “ls” command click here).
![](https://elearnbee.com/wp-content/uploads/2023/10/Studio-Project2-6-1024x522.png)
mv
- “mv” command is used to transfer a file or directory from one place to another. For an example: “$ mv file_to_move destination_path_of_the_directory/”.
mv elb_1.txt ../Practice/
![](https://elearnbee.com/wp-content/uploads/2023/10/Studio-Project3-7-1024x507.png)
cat
- The Linux “cat” command serves a number of purposes. It is useful for many file-related tasks, including creating new files, viewing existing ones, and copying their contents.
- To create a file use “cat > file_name” then write the content and press CTRL+D.
- To view the file content use “cat file_name”.
cat elb_3.txt
![](https://elearnbee.com/wp-content/uploads/2023/10/Studio-Project4-6-1024x526.png)
head
- Using the “head” command we can view the first 10 lines of a file.
head elb.txt
![](https://elearnbee.com/wp-content/uploads/2023/10/Studio-Project5-6-1024x526.png)
tail
- Using the “tail” command we can view the last 10 lines of a file.
tail elb.txt
![](https://elearnbee.com/wp-content/uploads/2023/10/Studio-Project6-6-1024x517.png)