Shell
Shell
Run programs
Mange computer
Csh--C shell
1. SHELL prompt
2. Terminal Window
3. Virtual Console.
>> “who am i” commands returns user name,terminal name with System boot time.
ahmad
>>who : Gives info about users who are currently logged in.
>> who -uH : -u adds info about idle time pid, -h is for header.
>> grep username /etc/passwd : It shows definition of user account in /etc/passwd file.
ahmad:x:1000:1000: ahmad:/home/ahmad:/bin/bash
>> man bash : If you want to read more about this shell.
>> date
/home/ahmad/Pictures
Localhost.localdomain
>>ls
[ahmad@localhost ~]$ ls
Command Syntax:
. .. a.out Storage
>>ls -lat : long listing -l, show hidden dot files -a,list by times -t.
total 24
>>to tell command to use whole word as an option use --(double hyphen)
Eg. ls --help
>> in this command we took output of “locate ls “ as input of “less “ by using Pipe[|].
Linux
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64
x86_64 x86_64 GNU/Linux
18/02/18
>> id command is used to get info about identity details.
[ahmad@localhost ~]$ id
Locating Commands:
Or add the the commands directories in SHELL’s PATH environment variable to run directly.
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/ahmad/.local/bin:/home/ahm
ad/bin
TIP:
If you want to add your own commands or shell scripts, place them in the bin directory in
your home directory (such
as /home/ahmad/bin for the user named ahmad). This directory is automatically added to your
path in some Linux systems, although you may need to create that directory or add it to your
PATH on other Linux systems. So, as long as you add the command to your bin with execute
permission, you can begin using it by simply typing the command name at your shell prompt. To
make commands available to all users, add them to /usr/local/bin.
Note:
The path directory order is important. Directories are checked from left to right. So, in this
example, if there is a command called foo located in both the /bin and /usr/bin directories, the
one in /bin is executed. To have the other foo command run, you either type the full path to the
command or change your PATH variable. (Changing your PATH and adding directories to it are
described later in this chapter.)
>> Order in which the shell checks for the commands you type:
3. Function :