Using Linux Commands
description
Transcript of Using Linux Commands
Using Linux Commands
Lab 2
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]$
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
To see a full listing of who is logged in and what they are doing
$ who w
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
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
To get back to your home directory:
To change the current directory to the directory that you choose:
$ cd
$ cd /etc
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
Checking directories and permissionsChecking directories and permissions
List the contents of your home directory
List the contents of your root directory
$ ls ~
$ ls /