Linux-Ubuntu/C2/Structure-of-Linux-Commands/English
Title of the script: Structure of Commands
Author: EduPyramids Team.
Keywords: command structure, command name, options, arguments, ls command, man, apropos, whatis, man -k, ls --help, video tutorial.
| Visual Cue | Narration |
| Slide 1
Title Slide |
Welcome to the Spoken tutorial on Structure of Linux Commands. |
| Slide 2
Learning Objectives In this tutorial, we will learn about:
|
In this tutorial, we will learn about:
|
| Slide 3
System Requirements |
To record this tutorial, I am using,
Ubuntu OS version 24 point 04. |
| Slide 4
Pre-requisites |
To follow this tutorial,
Learners should know basic Linux terminal commands. For the prerequisite Linux tutorials please visit this website. |
| Slide 5
Code files The following code file is required to practice this tutorial 1. sc-commands.txt This file is provided in the Code Files link of this tutorial page |
The following code file is required to practice this tutorial.
This file is provided in the Code Files link of this tutorial page. |
| Let us get started with the structure of Linux commands. | |
| Screencast:
Press Ctrl, Alt and T keys on your keyboard |
Open the terminal by pressing Ctrl, Alt, and T keys together. |
| Type: ls
press Enter Highlight all the files shown in the terminal. |
Type: ls.
ls command lists files and folders in a directory. Commands may be single words or multiple words separated by spaces. Press Enter. Here we can see all the files and folders in the Home directory. |
| Type: clear
press Enter. |
Type clear to clear the terminal window.
The clear command removes previous output from the terminal. press Enter. It gives a clean screen, making the terminal easier to read and work with. |
| Type: ls -a | Type ls space hyphen a.
The ls space hyphen a command lists all files and directories. |
| Slide 6
Structure of Linux Commands.
|
|
| Press enter
Highlight all the files shown in the terminal. |
Let me press Enter.
Here we can see all the files in the Home directory. |
| Type: clear and press Enter. | Type clear and press Enter to clear the terminal window. |
| Type: ls --all
Highlight the list of directories. |
Now type ls space hyphen hyphen all and press Enter.
ls space hyphen hyphen all lists all files and directories, and also hidden files that start with a dot. |
| Type: clear and press Enter.
Type: ls -d and press Enter. |
Again, type clear to clear the terminal .
Now type ls space hyphen d and press Enter. |
| Highlight the output: dot(.)
highlight -d |
Notice that only a single dot appears as output.
The dot represents the current directory. The hyphen d option tells Linux, show the directory itself, not what’s inside it. Since we didn’t give a directory name, Linux shows the current directory as dot. |
| Type: ls -d ALL and press Enter.
Highlight ALL |
Now, let’s try something different. Suppose we have a directory named ALL.
Type: ls space hyphen d space ALL and press Enter. We can see in the output, Linux prints ALL. It only shows the name of the directory. It does not list the files or folders inside ALL. |
| Only Narration. | In Linux we have a large number of commands.
Each command has many different options. So how do we keep track of it? In reality we don't have to. This is because of the excellent online help facilities available in Linux. The man command displays the manual pages for Linux commands. |
| Type man ls and press Enter.
Scroll up to show all the arguments Press q |
To learn more about the ls command,
type man space ls and press Enter. man is the system’s manual pager that displays documentation for commands. Arguments given to man are normally the name of a program, utility or function. Press q to exit the manual. |
| man command provides the hyphen k option.
It takes a keyword and returns a list of commands and their brief purpose. | |
| Type at the command prompt
man -k directories |
For example, to create a directory, we may not know the exact command.
So we can type man space hyphen k space directories and press Enter. |
| Scroll down to show all the commands related to directories. | Now we can search each of these commands to see what we actually need. |
| Type at the command prompt: apropos directories | We can do the same search using the apropos command.
I have opened another terminal window. Type apropos space directories and press Enter, to see the same output. |
| Scroll up to show all the commands related to directories.
Close the second terminal window. Type clear and press Enter |
The apropos command works similarly to man -k.
Both search for commands related to a keyword. I will close the second terminal window. Clear the screen. |
| Type whatis and press Enter.
Highlight the output Type man -f and press Enter. |
Type whatis and press Enter.
The output displays whatis space what question mark. The whatis command gives a one-line description of a command. Type man space hyphen f and press Enter. Both give one line description about the command. |
| Type at the command prompt
whatis ls |
Type whatis space ls and press Enter to see the output. |
| To know more options available for a command we can use the hyphen hyphen help option. | |
| Type: ls --help
Scroll up to show all the options available |
Type ls space hyphen hyphen help and press Enter.
Many commands also support the hyphen hyphen option. It displays a brief list of options directly on the terminal. |
| Slide 7
Summary In this tutorial, we learnt about:
|
With this we come to the end of this tutorial.
Let us summarise. |
| Slide 8
Assignment As an Assignment, Run the following commands and check the output:
|
As an Assignment, please do the following |
| Slide 9
Thank you |
This Spoken Tutorial is brought to you by EduPyramids educational services private limited SINE IIT Bombay. Thank you. |