Linux File Management Commands


Linux File Management Commands

Linux File Management Commands

Lately, since I have been making my games as multiplayer as much as possible and, when comparing server costs, Linux-based servers are cheaper, I have been working with the Linux operating system quite a lot. 
Since I work on the server architecture when using Linux, I am not working on a “Desktop” but necessarily on the terminal, and whenever I need to do file operations, I constantly forget the file management commands. That's why I felt the need to write down and share here the file management commands I use the most and their features. Let's take a look together at the 10 file management commands and features I use most on Linux. 

ls Command

Lists the files and folders in the current directory. 

ls Command

cd Command

Used to change directories. 
For example:
“cd Desktop”
With this command, you can enter the “Desktop” directory. 

pwd Command

Displays the current working directory. 

mkdir Command

Creates a new directory / folder. 
For example:
“mkdir newfolder”
When you enter the above command, a directory / folder named “newfolder” will be created. 

touch Command

Creates a new file, or if a folder with the name you entered already exists, updates its timestamp. 

cp Command

Copies the selected file or directory. Sends the copy to a destination you specify. 
For example:
“cp file.txt target/“
With the above command, you copy the “file.txt” file to the “target” directory. 

mv Command

Used to move or rename a selected file. 
For example:
“mv oldname.txt newname.txt”
With the above command, you change the name of the file called “oldname” into a file named “newname”. 

rm Command

This is the command we use to delete a file or directory. 
For example:
“rm filename.txt”
With the above command, you can delete the “filename.txt” file. 

cat Command

You can use it to display the contents of one or more files, or to merge multiple files. 

grep Command

Used to search for a specific text pattern inside a file. To give an example from Windows, it is the Linux command for the operation performed by the “ctrl + f” shortcut. 

Bonus : chmod Command

chmod is a command used in Linux-based operating systems to change permissions of files and directories. 
This command helps determine what rights the owner of the file, the group members, and other users will have.

There are three basic permissions for each file or directory in Linux:
  1. Read: Permission to read the contents of the file or directory.
  2. Write: Permission to modify or delete the content of the file or directory.
  3. Execute: If the file or directory is executable, permission to execute it.

With the chmod command, you can set these permissions. Permissions can be expressed using numerical or symbolic representation. In numerical representation, a number is used for each permission and the total number represents the set of permissions. In symbolic representation, users, groups, and other users are represented with symbols, and permissions are added or removed with the + and - signs.

The use of the chmod command is quite flexible, and you can set the permissions with various combinations.
For example;
“chmod u+rwx file.txt”
With the above command, you can give the user full permissions (read, write, execute) for the "file.txt" file.

chmod command