Introduction
The Linux command du (disk usage) is a useful tool for displaying the amount of disk space used by files and directories on a Linux system. It can be used to identify which files and directories are taking up the most disk space, and can be used to help manage disk space usage. It can also be used to compare disk usage between different directories. This guide will provide an overview of the du command and how to use it.
Examples
1. ls: Lists the contents of the current directory.
Example:
ls
2. cd: Changes the current working directory.
Example:
cd /home/user/Documents
3. mkdir: Creates a new directory.
Example:
mkdir my_new_directory
4. rm: Removes a file or directory.
Example:
rm my_file.txt
5. mv: Moves or renames a file or directory.
Example:
mv my_file.txt my_new_file.txt
Linux Command
Linux is a powerful and versatile open-source operating system. It is used by many people around the world for a variety of tasks, from web servers to desktop computing. The Linux command line is a powerful tool that allows users to control their system and perform various tasks. In this article, we will discuss some of the most commonly used Linux commands.
Navigation Commands
The first set of commands we will discuss are navigation commands. These commands allow you to move around the file system and view the contents of directories. The most commonly used navigation commands are cd, ls, and pwd.
- cd – This command allows you to change the current working directory. For example, if you wanted to change to the /home/user directory, you would type
cd /home/user
. - ls – This command lists the contents of the current working directory. For example, if you wanted to list the contents of the /home/user directory, you would type
ls /home/user
. - pwd – This command prints the current working directory. For example, if you wanted to print the current working directory, you would type
pwd
.
File Management Commands
The next set of commands we will discuss are file management commands. These commands allow you to create, delete, and modify files and directories. The most commonly used file management commands are touch, mkdir, rm, and mv.
- touch – This command creates an empty file. For example, if you wanted to create a file named
myfile.txt
, you would typetouch myfile.txt
. - mkdir – This command creates a new directory. For example, if you wanted to create a directory named
mydir
, you would typemkdir mydir
. - rm – This command deletes a file or directory. For example, if you wanted to delete the file
myfile.txt
, you would typerm myfile.txt
. - mv – This command moves a file or directory. For example, if you wanted to move the file
myfile.txt
to the directorymydir
, you would typemv myfile.txt mydir
.
System Administration Commands
The last set of commands we will discuss are system administration commands. These commands allow you to manage the system, such as installing and removing software, managing users, and more. The most commonly used system administration commands are sudo, apt-get, and useradd.
- sudo – This command allows you to execute a command as the root user. For example, if you wanted to install a package, you would type
sudo apt-get install package-name
. - apt-get – This command is used to install, remove, and update packages. For example, if you wanted to install the package
vim
, you would typesudo apt-get install vim
. - useradd – This command is used to add a new user to the system. For example, if you wanted to add a user named
john
, you would typesudo useradd john
.
These are just a few of the most commonly used Linux commands. There are many more commands available, and it is important to learn how to use them in order to get the most out of your Linux system.