Using Linux Commands

9
Using Linux Commands Lab 2

description

Using Linux Commands. Lab 2. The Shell Interface. The default prompt for a normal user is a dollar sign: $ preceded by user name , system name, and current directory, the date, the local computer name, or any string of characters: The prompt ---  the command you type ---  Enter. - PowerPoint PPT Presentation

Transcript of Using Linux Commands

Page 1: Using Linux Commands

Using Linux Commands

Lab 2

Page 2: Using Linux Commands

The Shell InterfaceThe Shell Interface

The default prompt for a normal user is a dollar sign:

$ preceded by user name , system name, and current directory, the date, the local computer name, or any string of characters:

The prompt --- the command you type --- Enter. The lines that follow show the output that results from the

command

$

[ jake@pine tmp]$

Page 3: Using Linux Commands

Checking your login sessionChecking your login session Login Identity includes:

user name, group name, user ID, and group IDuser name, group name, user ID, and group ID.. To find out information about your identity:

Linux keeps track of login session:when you logged in, how long you have been idle, and where you logged in from.when you logged in, how long you have been idle, and where you logged in from.

 -m option tells the who command to print information about the current user -u says to add information about idle time and the process ID -H asks that a header be printed

$ id

uid=501(chris) gid=105(sales) groups=105(sales), 4(adm), 7(lp)

$ who -umH

NAME LINE TIME IDLE PID COMMENT

chris tty1 jan 13 20:57 . 2013

Page 4: Using Linux Commands

To see a full listing of who is logged in and what they are doing

$ who w

Page 5: Using Linux Commands

Checking directories and permissionsChecking directories and permissionsTo find out what your current directory is:

To find out the name of your home directory:

$ pwd

/usr/bin

$ echo $HOME

/home/chris

Page 6: Using Linux Commands

System VariableMeaningBASH=/bin/bashOur shell name

BASH_VERSION=1.14.7(1)Our shell version name

COLUMNS=80No. of columns for our screen

HOME=/home/vivekOur home directory

LINES=25No. of columns for our screen

LOGNAME=studentsstudents Our logging name

OSTYPE=LinuxOur Os type

PATH=/usr/bin:/sbin:/bin:/usr/sbinOur path settings

PS1=[\u@\h \W]\$Our prompt settings

PWD=/home/students/CommonOur current working directory

SHELL=/bin/bashOur shell name

USERNAME=vivekUser name who is currently login to this PC

Page 7: Using Linux Commands

To get back to your home directory:

To change the current directory to the directory that you choose:

$ cd

$ cd /etc

Page 8: Using Linux Commands

Checking directories and permissionsChecking directories and permissionsTo list the contents of the current directory:

To list files across the page, separated by commas:

To list the contents of subdirectories:

$ ls –al /home/chris

total 158

drwxrwxrwx 3 chris sales 1024 May 12 13:55 .

drwxr-xr-x 3 root root 1024 May 10 01:49 ..

-rw------- 1 chris sales 2204 May 18 21:30 .bash_history

-rw-r--r-- 1 chris sales 24 May 10 01:50 .bash_logout

-rw-r--r-- 1 chris sales 230 May 10 01:50 .bash_profile

$ ls -m

$ ls -aR

Page 9: Using Linux Commands

Checking directories and permissionsChecking directories and permissions

List the contents of your home directory

List the contents of your root directory

$ ls ~

$ ls /