Professional Documents
Culture Documents
UNIT1
UNIT1
who
The who command is used to get information about currently
logged in user on to system.
EG:
:~$ who
hduser tty7 2018-03-18 19:08 (:0)
TTY
The terminal is also represented as a file. There a command
exists called tty which displays information related to termi‐
nal.
SYNTAX
tty [OPTION]....
Eg::~$sudo tty
/dev/pts/0
ECHO
e.g.:
We want to combine:
find -name deleteme.tar
tar -xvf deleteme.tar
rm -r delete/*
After combining
find -name deleteme.tar | tar -xvf deleteme.at | rm -r
delete/*
DATE
Command:
$date -u
Output :
Wed Oct 11 06:11:31 UTC 2017
BC
EG:
Input : $ echo "12+5" | bc
Output : 17
Input : $ echo "10^2" | bc
Output : 100
SCRIPT
script command in Linux is used to make typescript or record
all the terminal activities.
Syntax:
script [options] [file]
CAL
cal command is a calendar command in Linux which is used to
see the calendar of a specific month or a whole year.
e.g:
Syntax:
cal [ [ month ] year]
PASSWD
Example:
Command: passwd
CAT
4) Create a file
Command:
$ cat >newfile
Output
Will create and a file named newfile
5) Copy the contents of one file to another file.
Command:
$cat [filename-whose-contents-is-to-be-copied] >
[destination-filename]
Output
The content will be copied in destination file
6) Cat command can suppress repeated empty lines in out‐
put
Command:
$cat -s geeks.txt
Output
Will suppress repeated empty lines in output
7) Cat command can append the contents of one file to the
end of another file.
Command:
$cat file1 >> file2
Output
Will append the contents of one file to the end of
another file
UNAME
PRINTF
“printf” command in Linux is used to display the given string,
number or any other format specifier
Syntax:
$printf [-v var] format [arguments]
STTY
• stty -g: This option will print all current settings in a stty-
readable form. stty -g