Using The Shell
Using The Shell
●
About Shells and Terminal Windows
●
Choosing Your Shell, Running Commands
●
Running commands
●
Recalling Commands Using Command History
●
Connecting and Expanding Commands
●
Using Shell Variables
●
Creating Your Shell Environment
●
Getting Information About Commands
●
Sample programs
About Shells and Terminal Windows
On UNIX systems, from which Linux was derived, the program used
●
■ Right-click the desktop. In the context menu that appears, if you see Open in
Terminal, Shells, New Terminal, Terminal Window, Xterm, or some similar
item, select it to start a Terminal window. (Some distributions have disabled this
feature.)
■ Click on the panel menu. Many Linux desktops include a panel at the top or
bottom of the screen from which you can launch applications. For example,
in some systems that use the GNOME desktop, you can select Applications ➪
System Tools ➪ Terminal to open a Terminal window.
In all cases, you should be able to type a command as you would from a shell with
no GUI. Different terminal emulators are available with Linux. In Fedora, Red Hat
Enterprise Linux (RHEL), and other Linux distributions that use the GNOME
desktop,
Using virtual consoles
• Most Linux systems that include a desktop interface start multiple
virtual consoles running on the computer.
• Virtual consoles are a way to have multiple shell sessions open
at once in addition to the graphical interface you are using.
• You can switch between virtual consoles by holding the Ctrl and Alt
keys and pressing a function key between F1 and F7. For example,
in Fedora, press Ctrl+Alt+F1 (or F2, F3, F4, and so on up to F7 on
most Linux systems) to display one of seven virtual consoles.
The fi rst virtual workspace in Fedora is where the GUI is and the next
six virtual consoles are text-based virtual consoles. You can return to
the GUI (if one is running) by pressing Ctrl+Alt+F1. (On some systems
the GUI runs on the virtual console 7 or 5. So you’d return to the GUI
by pressing Ctrl+Alt+F5 or Ctrl+Alt+F7
About Shells and Terminal Windows
Choosing Your Shell
In most Linux systems, your default shell is the bash shell. To fi nd out what your
default
login shell is, type the following commands:
$ who am i
chris pts/0 2011-11-26 07:19 (:0.0)
$ grep chris /etc/passwd
cnegus:x:13597:13597:Chris Negus:/home/cnegus:/bin/bash
Common Shell Environment Variables
●
HOME
●
HOSTTYPE
●
MAIL(location of mailbox file)
●
OLDPWD
●
OSTYPE
●
PATH
●
PPID(The process ID of the command that started the current shell)
Common Shell Environment Variables
●
PROMPT_COMMAND
●
PS1(Sets the value of your shell prompt)
●
PWD
●
RANDOM
●
SECONDS
●
SHLVL
●
TMOUT
Creating and using aliases
●
alias p='pwd ; ls –CF'
●
alias rm='rm -i'
●
alias
●
unalias
Creating Your Shell Environment
●
Configuring your shell
●
Setting your prompt
●
Adding environment variables
Configuring your shell
Configuring your shell
Configuring your shell
●
nano $HOME/.bashrc
●
alias d="date +%D"
●
source $HOME/.bashrc
Setting your prompt
Setting your prompt
●
export PS1="[\t \w]\$ "
Adding environment variables
●
TMOUT
●
PATH
●
WHATEVER
Getting Information About Commands
●
Check the PATH
●
Use the help command
●
Use --help with the command
●
Use the info command
●
Use the man command
Manual page sections
This work is licensed under a Creative Commons
Attribution-ShareAlike 3.0 Unported License.
It makes use of the works of Mateus Machado Luna.