![Ubuntu Tutorial](/ubuntu/images/ubuntu-mini-logo.jpg)
- Ubuntu Tutorial
- Ubuntu - Home
- Ubuntu - Overview
- Ubuntu - Flavors
- Ubuntu - Environment
- Ubuntu - Device Drivers
- Ubuntu - Software Center
- Ubuntu - Browsers
- Ubuntu - Email
- Ubuntu - Messaging
- Ubuntu - Media Players
- Ubuntu - User Management
- Ubuntu - Files & Folders
- Ubuntu - Word Writer
- Ubuntu - Spreadsheets
- Ubuntu - LibreOffice
- Ubuntu - Command Line
- Ubuntu - Scripting
- Ubuntu - Networking
- Ubuntu - Server Installation
- Ubuntu - Secure Shell
- Ubuntu - Development
- Ubuntu - Nginx
- Ubuntu - Virtual Machines
- Ubuntu - Installing MySQL & Python
- Ubuntu - Node.js
- Ubuntu - Docker
- Ubuntu - On the Cloud
- Ubuntu Useful Resources
- Ubuntu - Quick Guide
- Ubuntu - Useful Resources
- Ubuntu - Discussion
Ubuntu - Command Line
Ubuntu is a Linux based operating system and most Linux users are more familiar with the command line interface. In this chapter, we will go through some of the popular command line’s used in Ubuntu.
Invoking the Command Line
To invoke the command line, go to the search option and enter the command keyword in the search box.
![Invoking Command Line](/ubuntu/images/invoking_command_line.jpg)
The search result will give the Terminal option. Double-lick to get the command line as shown in the following screenshot.
![Terminal Option](/ubuntu/images/terminal_option.jpg)
Directory Listing
The easiest command to start with, is the directory listing command which is used to list the directory contents.
Syntax
ls –option directoryname
Parameters
Option − These are the options to be specified with the ls command.
Directoryname − This is the optional directory name that can be specified along with the ls command.
Output
The output will be the listing of the directory contents.
Example
In the following example, we just issue the ls command to list the directory contents.
![List Directory Contents](/ubuntu/images/list_directory_contents.jpg)
The directory listing of the current directory will be shown as the output.
Another variant of the ls command is to list the directory, but with more details on each line item. This is shown in the following screenshot with the ls –l command.
![Another Variant](/ubuntu/images/another_variant.jpg)
Clearing the Screen
To clear the screen, we can use the clear command.
Syntax
clear
Parameters
None
Output
The command line screen will be cleared.
Command Help
To get more information on a command, we can use the ‘man’ command.
Syntax
man commandname
Parameters
Commandname − This is the name of the command for which more information is required.
Output
The information on the command will be displayed.
Example
Following is an example of the ‘man’ command. If we issue the ‘man ls’ command, we will get the following output. The output will contain information on the ls command.
![Command Help](/ubuntu/images/command_help.jpg)
Finding For Files
We can use the find command to find for files.
Syntax
find filepattern
Parameters
Filepattern − This is the pattern used to find for files.
Output
The files based on the file pattern will be displayed.
Example
In this example, we will issue the following command.
find Sample.*
This command will list all the files which start with the word ‘Sample’.
![Sample](/ubuntu/images/sample.jpg)
whoami
This command is used to display who is the current logged on user.
Syntax
whoami
Parameters
None
Output
The name of the current logged on user will be displayed.
Example
In this example, we will issue the following command.
whoami
![WHOAMI](/ubuntu/images/whoami.jpg)
Present Working Directory
This command will display the current working directory.
Syntax
pwd
Parameters
None
Output
The current working directory will be displayed.
Example
In this example, we will issue the following command.
Pwd
![Present Working Directory](/ubuntu/images/present_working_directory.jpg)
To Continue Learning Please Login