Linux File Management
21:49, 26.11.2026
File management in Linux is connected with different operations such as access control, creation, and modification of directories and files. In a Linux system, everything is treated as a file, including system configurations and various devices.
When talking about file management, there are plenty of processes connected with the deletion, copying, creation, renaming, or moving, as well as major processes related to the access control and file ownership.
In a Linux system, files can be divided into the following categories:
- Directory files.
- General files.
- Device files.
General Files
The category of general files is connected with the images, texts, and binaries. They usually represent the most commonly imagined data, such as scripts, docs, and programs.
Here are some general characteristics of general files:
- They are considered to be the biggest part of files in the system.
- They can consist of program data, executable binaries, or human-readable text.
- They are usually created with the touch command.
Directory files
Directory files can be compared with containers that create a specific hierarchy in directories and files.
Here are some of the basic characteristics of the directory files:
- With the help of mkdir command, new directories are created.
- There are some similarities with the folders in Windows.
- Store metadata and lists of file names.
Among the major directories, we can specify the home directory, root directory, and bin directory with important user binaries.
Device files
Device files are those that deal with input/output operations, and they are hardware devices. Some of the major characteristics of these types of files are:
- They are usually located in dev directory.
- They interact with actual physical devices such as terminals, printers, or any other possible options.
- With the help of these files, OS treats hardware as regular files.
Most common file management operations
Files listing
For the listing of the directories and files, ls command is used. The output of the command usually displays the content of directories, including details of ownership, timestamps, subdirectories, and permissions.
With the usage of the ls command, it is possible to:
- Easily identify the difference between the types of files, directories, and files.
- List all the directories and files in the current directory.
- For the better identification of the file type, another color is used for every type of file.
- The navigation between the directory content becomes more intuitive and faster.
For getting an access to the detailed listing of the files in the specific directory, the following command should be used:
$ls -l
In the output of this command, you will get the data about:
- Group and owner of every file.
- Permissions regarding who can execute, read, or write.
- Date of the last modification of the file and its size.
- Display some insights regarding the file management and security.
Creation of the files
For the creation of the new files in Linux, the most commonly used command is touch. In the situation when a certain file doesn’t exist, this command also creates a blank file. When the file is already created, after the execution of the command file’s content stays unaffected, and the timestamps can be updated.
Here is how the command should be used:
touch filename
Displaying the file content
For displaying the file content, cat command should be used. When using it, the full content of a certain file is created. When the file is very large, then for its viewing you can use less or more for easier content displaying, page by page.
Here is how the command should be used:
cat filename
Copying of the files
For the copying of the specific file in Linux, the cp command should be utilized. It functions by copying the content of the specific file into a new file that is in the specific destination. If you don’t specify another name, then the copied file will be created with the same original name.
Here is an example of the cp command usage:
cp source/file.txt destination/ or cp source/filename destination/newname
Moving of the file
For the moving of the specific file from one location to another – mv command is used. It functions by removing a file from one directory and replacing it with another with the same original name and content. Also, with the help of this command, it is possible to rename a moved file.
Here is an example of how the command is used:
mv source/filename destination/ or mv source/filename destination/newname
File deleting
For deleting the files – rm command should be used. It functions by removing a certain file from the directory. It is recommended to use this command with caution, as the recovery of the deleted file is not as easy as its removal.
Here is an example of how the command should be used:
rm filename