GETTING STARTED
WITH
BASIC COMMANDS
LINUX & SCRIPTING
Mr. RAM
LOGIN PROCEDURE:
When switch on your system it will ask your Login name and password, that
is as follows:
FOR NORMAL USER: FOR SUPER USER:
Login: ram Login: root
Password: password Password: password
After you had entered correct Login name and password, then it will show:
# ---> Super User Prompt
$ ---> Normal user prompt
LINUX COMMAND SYNTAX:
All commands have a similar format.
commands are generally two to five characters.
commands are case sensitive.
Options always preceded file names.
Options are prefixed using a - symbol.
The man command can be used to display the correct syntax.
If you make typing mistakes press backspace to erase characters.
To cancel entire the command before you press enter, press the delete
key.
Don't turn off the computer if you have made mistake press ctrl+d.
COMMAND LINE STRUCTURE:
A command is a program that tells the UNIX system to do something.
It has the form:
$command -[options] [arguments]
Where an argument indicates on what the command is to perform its
action, usually a file or series of files. An option modifies the command,
changing the way it performs.
Options are generally preceded by a hyphen (-), and for most commands,
more than one option can be strung together, in the form:
$command -[options] [options] [options]
LINUX & SCRIPTING
Mr. RAM
GETTING HELP COMMANDS:
Linux distributions contain three powerful sets of documentation to enable
users and administrators to get the most out of the system.
Knowing how to use these resources effectively is an essential skill for
Linux users.
Here are the four documentation sets:
Man pages
Info pages
Help Pages
/usr/share/docs
GETTING HELP WITH “MAN”:
It is used to display the user manual of any command.
Every manual page is discovered:
The command's summary
Options and explanations
Examples
Author and maintainer
SYNTAX: $man [options] <command>
$man date
$man pwd
$man man
NOTE: Press “q” to quit.
List all available man pages on the system and provide a short description.
$man -k .
Output a short description of the specified man page. Keyword must be the
exact name of a man page.
$man -f <keyword>
$man -f dnf
LINUX & SCRIPTING
Mr. RAM
GETTING HELP WITH “INFO”:
The info pages play a similar role to man pages, though they tend to be a
little more user-friendly.
The man pages are basically a short description.
SYNTAX: $info [options] <command>
$info ls
To get bash command information:
$info bash
GETTING HELP WITH “--HELP”:
Many commands provide a built-in help message that you can access using
the --help option.
It displays help of the given command.
SYNTAX: $command --help
$help
$date --help
To get bash command help:
$bash -help
(or)
$bash -h
To get pwd command help option:
$pwd --help
LINUX & SCRIPTING
Mr. RAM
BASIC COMMANDS:
For you to be able to work with different parts of the system, you need to
know how to get around the system! In this section, we look at the following
basic commands:
$pwd : It shows Present Working Directory
$date : Print or set system date and time
$cal : Display a calendar
$cal 2050 : Displays 2050-year total month calendars
$cal 08 2050: Aug 2050-year calendar.
$whoami : Print effective user name
$logname : Displays current login username
$uname : Displays system information
$uname -r : Release kernel version
$uname -i : Print hardware platform
$arch : Displays os architecture
$uname -a : Print all information
$who / w : Displays who is logged on
$who -b : Print system last reboot time
$uptime : How long server is up and running time, connected users and
load average.
$free -m : To check free and used memory space
$df -h : To check disk free size
$du -h : To check disk usage
$tty : Terminal position
$which : Shows full path of commands (E.g.: $which date)
$whereis : Locate the binary, source, manual page files for a command.
$clear : To clear the terminal screen