Using The Shell
Using The Shell
● To determine what aliases are set on the current shell use the alias
command.
alias name=command
● Aliases created this way only persist while the shell is open. Once the shell
is closed, the new aliases are lost.
Basic Command Syntax
● Command syntax:
● To execute a command, the first step is to type the name of the command.
sysadmin@localhost:~$ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
Specifying Arguments
● Typically, arguments follow options.
● Short options are specified with a hyphen - followed by a single character (ie –a).
● Long options for commands are preceded by a double hyphen -- (i.e. --all).
● The lone double hyphen -- option can be used to indicate the end of all options for
the command.
● BSD style options do not use hyphens, just a single character (i.e. a)
Display System Information
● The uname command displays useful system information.
● There are many options available for the uname command. For example:
sysadmin@localhost:~$ pwd
/home/sysadmin
sysadmin@localhost:~$ cd Documents/
sysadmin@localhost:~/Documents$ pwd
/home/sysadmin/Documents
Command Information
● The type command displays information about a command type.
sysadmin@localhost:~$ type -a ls
ls is aliased to `ls --color-auto’
ls is /bin/ls
● The which command searches for the location of a command in the system
by searching the PATH variable.
Command Completion
● The Bash shell provides the ability to complete commands and their
arguments automatically.
● Type a few characters of a command (or its file name argument) and then
press the Tab key twice, this will provide a list of files that match.
sysadmin@localhost:~$ ca
cal capsh cat cautious-launcher
calendar captoinfo catchsegv
caller case catman
Getting Help
● The man command will display documentation for commands:
sysadmin@localhost:~$ man pwd
● You can control the man page display by using movement commands such
as:
o Space bar = Go down one page
o b = Go up one page
o 1G = Go to beginning of man page
o G = Go to end of man page
o h = display help screen
o /term [Enter] = Search for term
Sections Within Man Pages
o AUTHOR= Provides the name of the person who created the man page and
(sometimes) how to contact the person.
Sections Within Man Pages
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speci-
fied.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
Output Omitted...
AUTHOR
Written by Richard M. Stallman and David MacKenzie.
REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report ls translation bugs to http://translationproject.org/team/
COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU
GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
Full documentation at: <http://www.gnu.org/software/coreutils/ls>
or available locally via: info '(coreutils) ls invocation'
Searching by Name or Keyword
man –k keyword