Open In App

25 basic Ubuntu Commands

Last Updated : 28 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Ubuntu is one of the most popular distributions of Linux, known for its user-friendly interface and robust features. Whether you're a beginner or an experienced user, understanding basic Ubuntu commands is essential for navigating and managing your system efficiently.

1. pwd - Print Working Directory

The pwd command is used to display the current working directory.

Syntax:

pwd

Example:

pwd
displaying the current directory
displaying the current directory

This command prints the current working directory.

2. ls - List Directory

The ls command is one of the most frequently used commands in Linux. It displays the contents of directories, including files and subdirectories.

Syntax:

ls [options] [directory]

Example:

ls
lss

Here, we shows the lists of directories, files, and images by the using of ls command.

Options of ls command

here is some examples using in to the ls command.

CommandUses
lsLists files in the current directory
ls /home/user/Lists files in /home/user/
ls -lLong listing format (permissions, size, dates)
ls -aIncludes hidden files (starting with .)
ls -lhLong listing with human-readable sizes
ls -ltSorts files by modification time
ls -RRecursively lists all subdirectories
ls -d */Shows only directories in the current path

2. cd - Change Directory

The cd command is used to change the current working directory. we can move one directory to other directory by the using of cd command in Linux Terminal.

Syntax:

cd [directory]

Example:

cd Desktop/
changing directory
changing directory

This command changes the current directory to Desktop/. Here we have used pwd command to display the current directory.

Cd command is used for moving multiple directories in single time

Syntax:

cd home/administrator/Desktop

We can exit from the directory by using cd command

Syntax:

cd ../

4. mkdir - Make Directory

The mkdir command is used to create a new directory.

Syntax:

mkdir [directory_name]

Example:

mkdir new_folder
mkdir

This command creates a new directory named new_folder. Here we have used ls command to display the files in the current directory.

5. rm - Remove

The rm command is used to remove or delete the files or directories.

Syntax:

rm [options] [file/directory]

Example:

rm new_file
removing file
removing file

This rm command removes the file named new_file. Here we have used ls command to display the files in the current directory.

6. cp - Copy

The cp command is used to copy files or directories.

Syntax:

cp [options] [source] [destination]

Example:

cp file.txt /home/sujal/localworkingDir/Dir1/
cp

The ls command show file.txt which had present on localworkingDir then it will move to other directory named Dir1 by the using of cp command.

7. mv - Move

The mv command is used to move files or directories. mv command is also used to rename the file.

Syntax:

mv [options] [source] [destination]

Example:

mv 
mv

Here, We have move the file named 'file.txt' from the 'Dir2' directory to the current working directory named 'localworkingDir' by using mv command.

8. touch - Create Empty File

The touch command is used to create an empty file.

Syntax:

touch [file_name]

Example:

touch newfile.txt
creating text file
creating text file

This command creates an empty file named newfile.txt. Here we have used ls command to display the files in the current directory.

9. cat - Concatenate and Display

The cat command is used to display the contents of a file.

Syntax:

cat [file]

Example:

cat newfile.txt
displaying text inside text file
displaying text inside text file

This cat command displays the contents of newfile.txt.

10. nano - Text Editor

The nano command is used for launch the Nano text editor. It allows you to create and edit text files directly from the command line.

Syntax:

nano [file_name]

Example:

nano newfile.txt
editing text file
editing text file

This command opens newfile.txt in the Nano text editor.

The grep command is used to search for patterns in files.

Syntax:

grep [options] [pattern] [file]

Example:

grep "pattern" file.txt
searching pattern inside the text file
searching pattern inside the text file

This command searches for the specified pattern in file.txt.

12. sudo - Superuser Do

The sudo command allows users to execute commands with superuser privileges.

Syntax:

sudo [command]

Example:

sudo apt-get update
updating package manager
updating package manager

This command updates the package lists using apt-get with superuser privileges.

13. apt-get - Package Manager

The apt-get command is used to manage software packages.

Syntax:

sudo apt-get install package_name

Example:

sudo apt-get install notepad
sudo

This command installs a package named notepad.

14. dpkg - Package Manager

The dpkg command is used to install, remove, and manage Debian packages.

Syntax:

sudo dpkg [options] [command]

Example:

sudo dpkg -i package.deb

This command installs a Debian package named package.deb.

15. wget - Download

The wget command is used to download files from the internet.

Syntax:

wget [URL]

Example:

wget http://example.com/file.zip

This command downloads a file named file.zip from the specified URL.

16. chmod - Change Mode

The chmod command is used to change file permissions.

Syntax:

chmod [options] [mode] [file]

Example:

chmod 777 file.txt
chmod

This command changes the permissions of file.txt to 777.

17. chown - Change Owner

The chown command is used to change file ownership of files or directory.

Syntax:

chown [options] [owner:group] [file]

Example:

chown sujal file.txt
chown1

This command changes the owner and group of file.txt.

18. tar - Tape Archive

The tar command in Linux is used to create, extract, and manage archive files such as .tar, .tar.gz, or .tgz. It is commonly used to combine multiple files and directories into a single archive file, often with optional compression

Syntax:

tar [options] [archive_name.tar] [files/directories]

Example:

tar -cvf gfg.tar file1 file2 dir1/
tar

This command creates a compressed tar archive named archive.gfg.tar from the directory

19. uname - Print System Information

The uname command prints system information such as kernel version and architecture.

Syntax:

uname [options]

Example:

uname -a
uname

This command displays all available system information.

20. date - Display Date and Time

The date command displays the current date and time.

Syntax:

date [options]

Example:

date
displaying date
displaying date

This command prints the current date and time.

21. shutdown - Shutdown or Restart System

The shutdown command is used to shut down or restart the system.

Syntax:

sudo shutdown [options]

Example:

sudo shutdown -h now

This command shuts down the system immediately.

22. ps - Process Status

The ps command displays information about active processes.

Syntax:

ps [options]

Example:

ps aux
list all running process
list all running process

This command lists all running processes.

23. top - Display System Activity

The top command displays real-time information about system activity.

Syntax:

top

Example:

top
displaying dynamic information
displaying dynamic information

This command displays dynamic information about system processes.

24. du - Disk Usage

The du command is used to estimate file and directory space usage.

Syntax:

du [options] [directory]

Example:

du -sh /path/to/directory
du

This command displays the disk usage of the specified directory.

25. df - Disk Free

The df command displays disk space usage for filesystems.

Syntax:

df [options]

Example:

df -h
display disk space
display disk space

This command displays disk space usage in a human-readable format.

Conclusion

These 25 basic Ubuntu commands provide a solid foundation for navigating and managing your Linux system effectively. As you continue to explore Ubuntu and Linux, you'll discover more commands and techniques to streamline your workflow and enhance your productivity. Experiment with these commands in your terminal to become more proficient in using Ubuntu.


Article Tags :

Similar Reads