Kali Linux – File Management

In Kali Linux, most of the operations are performed on files. And to handle these files Kali Linux has directories also known as folders which are maintained in a tree-like structure. Though, these directories are also a type of file themselves. Kali Linux has 3 basic types of files:

  1. Regular Files: It is the common file type in Linux. it includes files like – text files, images, binary files, etc. Such files can be created using the touch command. They consist of the majority of files in the Linux/UNIX system. The regular file contains ASCII or Human Readable text, executable program binaries, program data, and much more.
  2. Directories: Windows call these directories as folders. These are the files that store the list of file names and the related information. The root directory(/) is the base of the system, /home/ is the default location for user’s home directories, /bin for Essential User Binaries, /boot – Static Boot Files, etc. We could create new directories with mkdir command.
  3. Special Files: Represents a real physical device such as a printer which is used for IO operations. Device or special files are used for device Input/Output(I/O) on UNIX and Linux systems. You can see them in a file system as an ordinary directory or file.

    In Unix systems, there are two types of special files for each device, i.e. character special files and block special files. For more details, read the article Unix file system.

You can read more about the Linux File Management.

Kali Linux – File Hierarchy Structure

Kali Linux follows a specific File hierarchy structure which is just a way of organizing files, filesystems, directories, installed packages, and external devices connected to the system. It basically sets a standard or a base for defining the directory structure.

Linux-File-Hierarchy Structure

In Kali Linux File Hierarchy Structure the base or the main directory which contains all the directories is the root directory depicted by a “/”.



Managing and Working with Files in Kali Linux

1. To List the Files. In Kali Linux, we use ls command to list files and directories. To use this enter the following command in the terminal.

ls

listing-files-linux

This command will print all the file and directories in the current directory.

2. To create a new file. In Kali Linux, we use touch command to create a new file. To use this enter the following command in the terminal.

touch filename.extension

touch-command-linux

This command will create a new file named filename.extension.

3. To display the content of a file. In Kali Linux, we use cat command to display the contents of a file. To use this enter the following command in the terminal.

cat filename.extension

cat-command-linux



This command will print the content of the filename.extension file.

4. To copy files. In Kali Linux, we use cp command to copy files and directories. To use this enter the following command in the terminal.

cp old/location/of/file /new/location/of/file

copy-files-linux

This command will copy file form old location to new location.

5. To move files. In Kali Linux, we use mv command to move files and directories. To use this enter the following command in the terminal.

mv old/location/of/file /new/location/of/file

moving-files-linux

This command will move the file form old location to new location.

6. To rename a file. In Kali Linux, we use mv command to rename files and directories. To use this enter the following command in the terminal.

mv filename.extension new_name.extension

rename-file-linux

This command will rename the file from filename.extension to new_name.extension.

7. To delete a file. In Kali Linux, we use rm command to delete files and directories. To use this enter the following command in the terminal.

rm filename.extension

remove-files-linux

This command will remove/delete the filename.extension from the current directory.

8. To edit a file. In Kali Linux, we use nano command to edit files. To use this enter the following command in the terminal.

nano filename.extension

nano-linux

This command will open an editor to write to file and after completing the same press ctrl+o to save the file.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.