Tuesday, May 28, 2024

Linux Commands For File Administration


A utility for viewing the contents of directories. By default it shows the current directory. If you specify path in parameters, it will list contents of destination directory. Useful options are -l (List) and -a (All). The first one formats the output as a list with more details and the second one shows hidden files.

Prints the contents of the file passed in the parameter to the standard output. If multiple files are passed, the command will concatenate them. You can also redirect the output to another file using the ‘>’ character. If you want to print only a specified number of lines, use option -n (Number).

Allows jumping from the current directory to the specified one. If run without parameters, it will return to the home directory. Call with two dots will return one level up from the current directory. Call with dashes (cd -) will return to previous directory.

Prints the current directory on the screen. This may be useful if your Linux command line does not display such information. This command will be useful in Bash programming, where a script is executed to get the directory reference.

Creates new directories. The most useful option is -p (Parents), which allows to create entire subdirectory structure with one command, even if they don’t exist yet.

The file command shows the type of a file. In Linux, files are not always required to have an extension in order to be usable. Therefore, it is sometimes difficult for the user to know the type of file he is looking for. This small utility solves the problem.

Copy files and directories. It does not copy directories recursively by default (i.e. all subdirectories and all files in subdirectories), so be sure to add the -r (Recursive) or -a (Archive) option. The latter enables the retention of attributes, owner and timestamp in addition to recursive copying.

Move or rename files and directories. Notably, this is the same operation in Linux. Renaming is moving a file to the same folder with a different name.

Deletes files and folders. A very useful Linux command: you can use it to clean up the mess. If recursive deletion is needed, use the -r option. Be careful though: of course, you will need to do some serious work to corrupt the system, but you can remove your own important files. Rm does not erase files to the Recycle Bin, from which they can be recovered later, but rather erases them completely. The actions of the rm operator are irreversible. Believe me, your excuses like “rm ate my term paper” won’t interest anyone.

Creates hard or symbolic links to files. Symbolic or program links are something similar to shortcuts in Windows. They provide a convenient way to access a particular file. Symbolic links point to a file but have no metadata. Hard links, unlike symbolic links, point to the physical address of the disk area where the file data is stored.

Changes the permissions of a file. These are read, write and execute. Each user can change permissions for his files.

Changes the owner of a file. Only the superuser can change owners. For recursive modification use option -R.

Search the file system, files and folders. This is a very flexible and powerful Linux command, not only because of its sniffer capabilities, but also because of its ability to perform arbitrary commands on found files.

Unlike find, the locate command searches the updatedb database for filename patterns. This database contains a snapshot of the filesystem, which allows for a very fast search. But this search is unreliable, because you cannot be sure that nothing has changed since the last snapshot.

Shows the size of a file or directory. The most useful options are: -h (Human), which converts file sizes to an easy-to-read format, -s (Summarize), which outputs the minimum data, and -d (Depth), which sets the depth of recursion through directories.

Disk space analyzer. By default, output is quite detailed, listing all file systems, their size, and the amount of used and free space. There is a -h option for convenience, making the sizes easy to read.

As the official manual says, this is a terminal command to copy and convert files. It’s not a very clear description, but that’s all dd does. You give it a source file, a destination and a couple of additional options. It then makes a copy of one file to another. You can set the exact size of the data to be written or copied. The utility works with all devices. For example, if you want to overwrite a harddisk with zeros from /dev/zero, you can do so. It is also often used to create LiveUSB or hybrid ISO images.

These are Linux console commands to mount and unmount Linux filesystems. You can mount anything from USB sticks, to ISO images. And only the superuser has permissions to do so.


Related Articles

- Advertisment -spot_img
- Advertisment -spot_img

Recent Articles


Popular Articles

digital marketing in nepal