0% found this document useful (0 votes)
59 views

PDF Bash Commands DD

This document provides an A-Z index of common Bash commands and their brief descriptions. It lists over 50 commands, from alias to zip, explaining what each command is used for in 1-2 sentences. For example, alias is described as "Create an alias" and apt-get is described as "Search for and install software packages (Debian/Ubuntu)". The document serves as a quick reference guide to the most frequently used Bash commands and their basic functions.

Uploaded by

Alizebth jam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

PDF Bash Commands DD

This document provides an A-Z index of common Bash commands and their brief descriptions. It lists over 50 commands, from alias to zip, explaining what each command is used for in 1-2 sentences. For example, alias is described as "Create an alias" and apt-get is described as "Search for and install software packages (Debian/Ubuntu)". The document serves as a quick reference guide to the most frequently used Bash commands and their basic functions.

Uploaded by

Alizebth jam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

 An A-Z Index of the Bash


Bash command
 command line for Linux.
alias 
alias  Create an alias •
apropos Search Help manual pages (man -k)
apt-get 
apt-get   Search for and install software packages
(Debian/Ubuntu)
aptitude
aptitude Search
 Search for and install software packages
(Debian/Ubuntu)
aspell 
aspell   Spell Checker
awk
awk 
  Find and Replace text, database sort/validate/index
b
basename Strip
basename  Strip directory and suffix from filenames
bash GNU Bourne-Again SHell
bc
bc 
  Arbitrary precision calculator language
bg 
bg  Send to background
break 
break  Exit from a loop •
builtin 
builtin  Run a shell builtin
bzip2 
bzip2  Compress or decompress named file(s)
c
cal
cal 
  Display a calendar
case 
case  Conditionally perform a command
cat 
cat  Concatenate and print (display) the content of files
cd 
cd  Change Directory
cfdisk
cfdisk   Partition table manipulator for Linux
chgrp
chgrp 
  Change group ownership
chmod 
chmod  Change access permissions
chown 
chown  Change file owner and group
chroot  Run a command with a different root directory
chroot 
chkconfig
chkconfig System
 System services (runlevel)
cksum 
cksum  Print CRC checksum and byte counts
clear Clear terminal screen
cmp 
cmp  Compare two files
comm
comm 
  Compare two sorted files line by line
command
command   Run a command - ignoring shell functions •
continue Resume
continue  Resume the next iteration of a loop •
cp
cp 
  Copy one or more files to another location
cron 
cron  Daemon to execute scheduled commands
crontab 
crontab  Schedule a command
command to run at a later time
csplit 
csplit   Split a file into context-determined pieces
cut 
cut  Divide a file into several parts
d
date
date 
  Display or change the date & time
dc 
dc  Desk Calculator
dd 
dd  Convert and copy a file, write disk headers, boot
records

ddrescue Data
ddrescue
declare
declare   Data recovery
Declare tooland give them attributes •
variables

ENGR. M SHUMRAIZ SHARIF 1 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

df
df 
  Display free disk space
diff 
diff  Display the differences between two files
diff3
diff3 
  Show differences among three files
dig 
dig  DNS lookup
dir
dir 
  Briefly list directory contents
dircolors
dircolors Colour
 Colour setup for `ls'
dirname 
dirname   Convert a full
full pathname to just
just a path
dirs
dirs 
  Display list of remembered directories
dmesg 
dmesg  Print kernel & driver messages
du 
du  Estimate file space usage
e
echo 
echo  Display message on screen •
egrep
egrep 
  Search file(s) for lines that match an extended
expression
eject 
eject  Eject removable media
enable 
enable   Enable and disable builtin shell commands •
env
env 
  Environment variables
ethtool Ethernet card settings
eval
eval 
  Evaluate several commands/arguments
exec 
exec  Execute a command
exit
exit 
  Exit the shell
expect
expect   Automate arbitrary applications accessed over a
terminal
expand 
expand   Convert tabs to spaces
export 
export   Set an environment variable
expr
expr 
  Evaluate expressions
f
false
false 
  Do nothing, unsuccessfully
fdformat Low-level
fdformat Low-level format a floppy disk
fdisk
fdisk 
  Partition table manipulator for Linux
fg 
fg  Send job to foreground
fgrep 
fgrep  Search file(s) for lines that match a fixed string
file
file 
  Determine file type
find
find 
  Search for files that meet a desired criteria
fmt 
fmt  Reformat paragraph text
fold
fold 
  Wrap text to fit a specified width.
for 
for  Expand words, and execute commands 
format Format disks or tapes
free Display memory usage
fsck 
fsck  File system consistency check and repair
ftp File Transfer Protocol
function
function Define
 Define Function Macros
fuser
fuser 
  Identify/kill the process that is accessing a file
g
gawk 
gawk  Find and Replace text within file(s)
getopts 
getopts  Parse positional parameters
grep
grep 
  Search file(s) for lines that match a given pattern

ENGR. M SHUMRAIZ SHARIF 2 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

groupadd
groupadd Add
 Add a user security group
groupdel Delete
groupdel  Delete a group
groupmod
groupmod Modify
 Modify a group
groups 
groups   Print group names a user is in
gzip 
gzip  Compress or decompress named file(s)
h
hash 
hash  Remember the full pathname of a name argument
head 
head  Output the first part of file(s)
help Display help for a built-in command •
history
history   Command History
hostname Print
hostname  Print or set system name
i
iconv
iconv 
  Convert the character set of a file
id 
id  Print user and group id's
if 
if  Conditionally perform a command
ifconfig Configure
ifconfig Configure a network interface
ifdown
ifdown   Stop a network interface
ifup 
ifup  Start a network interface up
import  Capture an X server screen and save the image to file
import 
install 
install   Copy files and set attributes
j
jobs
jobs 
  List active jobs •
join 
join  Join lines on a common field
k
kill
kill 
  Stop a process from running
killall  Kill processes by name
killall 
l
less
less 
  Display output one screen at a time
let 
let  Perform arithmetic on shell variables •
link 
link  Create a link to a file
ln 
ln  Create a symbolic link to a file
local 
local  Create variables •
locate
locate   Find files
logname 
logname  Print current login name
logout 
logout   Exit a login shell •
look 
look  Display lines beginning with a given string
lpc 
lpc  Line printer control program
lpr
lpr 
  Off line print
lprint Print a file
lprintd Abort a print job
lprintq List the print queue
lprm 
lprm  Remove jobs from the print queue
ls
ls 
  List information about file(s)
lsof 
lsof  List open files
m
make Recompile a group of programs
man
man 
  Help manual

ENGR. M SHUMRAIZ SHARIF 3 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

mkdir
mkdir 
  Create new folder(s)
mkfifo 
mkfifo  Make FIFOs (named pipes)
mkisofs Create an hybrid ISO9660/JOLIET/HFS filesystem
mknod
mknod 
  Make block or character special files
more 
more  Display output one screen at a time
most
most 
  Browse or page through a text file
mount 
mount  Mount a file system
mtools 
mtools  Manipulate MS-DOS files
mtr 
mtr  Network diagnostics (traceroute/ping)
mv 
mv  Move or rename files or directories
mmv 
mmv  Mass Move and rename (files)
n
netstat Networking information
nice 
nice  Set the priority of a command or job
nl
nl 
  Number lines and write files
nohup
nohup 
  Run a command immune to hangups
notify-send 
notify-send  Send desktop notifications
nslookup
nslookup Query
 Query Internet name servers interactively
o
open 
open  Open a file in its default application
op 
op  Operator access
p
passwd 
passwd  Modify a user password
paste 
paste  Merge lines of files
pathchk Check file name portability
ping 
ping  Test a network connection
pkill
pkill 
  Stop processes from running
popd 
popd  Restore the previous value of the current directory
pr
pr 
  Prepare files for printing
printcap Printer capability database
printenv Print environment variables
printf 
printf  Format and print data •
ps 
ps  Process status
pushd 
pushd  Save and then change the current directory
pv 
pv  Monitor the progress of data through a pipe
pwd 
pwd  Print Working Directory
q
quota 
quota  Display disk usage and limits
quotacheck Scan a file system for disk usage
quotacheck Scan
quotactl Set
quotactl Set disk quotas
r
ram
ram 
  ram disk device
rcp
rcp 
  Copy files between two machines
read 
read  Read a line from standard input •
readarray Read from stdin into an array variable •
readonly Mark variables/functions as readonly
readonly Mark
reboot Reboot the system

ENGR. M SHUMRAIZ SHARIF 4 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

rename
rename   Rename files
renice Alter priority of running processes
remsync Synchronize remote files via email
return 
return  Exit a shell function
rev 
rev  Reverse lines of a file
rm
rm 
  Remove files
rmdir 
rmdir  Remove folder(s)
rsync 
rsync  Remote file copy (Synchronize file trees)
s
screen 
screen  Multiplex terminal, run remote shells via ssh
scp 
scp  Secure copy (remote file copy)
sdiff
sdiff 
  Merge two files interactively
sed
sed 
  Stream Editor
select 
select   Accept keyboard input
seq
seq 
  Print numeric sequences
set 
set  Manipulate shell variables and functions
sftp Secure File Transfer Program
shift
shift 
  Shift positional parameters
shopt 
shopt  Shell Options
shutdown Shutdown
shutdown  Shutdown or restart linux
sleep
sleep 
  Delay for a specified time
slocate 
slocate  Find files
sort 
sort  Sort text files
source
source   Run commands from a file '.'
split 
split  Split a file into fixed-size pieces
ssh 
ssh  Secure Shell client (remote login program)
stat
stat 
  Display file or file system status
strace 
strace  Trace system calls and signals
su 
su  Substitute user identity
sudo
sudo 
  Execute a command as another user
sum 
sum  Print a checksum for a file
suspend 
suspend   Suspend execution of this shell •
sync
sync 
  Synchronize data on disk with memory
t
tail
tail 
  Output the last part of file
tar 
tar  Store, list or extract files in an archive
tee 
tee  Redirect output to multiple files
test
test 
  Evaluate a conditional expression
time
time 
  Measure Program running time
timeout 
timeout  Run a command with a time limit
times
times 
  User and system times
touch 
touch  Change file timestamps
top 
top  List processes running on the system
traceroute Trace
traceroute  Trace Route to Host
trap Run a command when a signal is set(bourne)
tr
tr 
  Translate, squeeze, and/or delete characters
true 
true  Do nothing, successfully

ENGR. M SHUMRAIZ SHARIF 5 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

tsort
tsort 
  Topological sort
tty 
tty  Print filename of terminal on stdin
type 
type  Describe a command •
u
ulimit 
ulimit   Limit user resources •
umask
umask 
  Users file creation mask
umount Unmount a device
unalias  Remove an alias •
unalias 
uname
uname 
  Print system information
unexpand Convert
unexpand Convert spaces to tabs
uniq 
uniq  Uniquify files
units
units 
  Convert units from one scale to another
unset 
unset  Remove variable or function names
unshar 
unshar   Unpack shell archive scripts
until 
until  Execute commands (until error)
uptime Show uptime
useradd  Create new user account
useradd 
userdel
userdel   Delete a user account
usermod 
usermod   Modify user account
users
users 
  List users currently logged in
uuencode Encode a binary file
uuencode Encode
uudecode Decode
uudecode  Decode a file created by uuencode
v
v Verbosely list directory contents (`ls -l -b')
vdir Verbosely list directory contents (`ls -l -b')
vi 
vi  Text Editor
vmstat 
vmstat  Report virtual memory statistics
w
wait 
wait  Wait for a process to complete •
watch
watch 
  Execute/display a program periodically
wc 
wc  Print byte, word, and line counts
whereis 
whereis  Search the
the user's
user's $path, man pages and source files
for a program
which
which 
  Search the user's $path for a program file
while 
while  Execute commands
who 
who  Print all usernames currently logged in
whoami 
whoami   Print the current user id and name (`id -un')
wget Retrieve web pages or files via HTTP, HTTPS or FTP
write
write 
  Send a message to another user
x
xargs 
xargs  Execute utility, passing constructed argument list(s)
xdg-open Open
xdg-open Open a file or URL in the user's preferred
application.
yes 
yes  Print a string until interrupted
zip
zip 
  Package and compress (archive) files.
.  Run a command script in the current shell
!! 
!!  Run the last command again

ENGR. M SHUMRAIZ SHARIF 6 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

###
### 
  Comment / Remark

The first column is the permissions of each file. if it begins with a - it is a normal file, if it begins with a d,
then it is a directory i.e. a folder containing other files or folders.

Who Permission Numbers

u - owning user r - read 4 - read

g - group w - write 2 - write

o - others x - execute/search 1 - execute

a - all

What the permissions mean


The first three letters, after the first - or d, are the permissions the owner has. The next three letters are
permissions that apply to the group. The final three letters are the permissions that apply to everyone
else. Each set of three letters is made up of r w and
w and x. r  is
 is always in the first position, w is always in the
second position, and x is always in the third position. r  is
 is the read permission, wis the write permission,

and x is the execute permission. If there is a hyphen (- ( -) in the place of one of these letters it means the
permission is not granted, and if the letter is present then it is granted.

Folders

In case of folders the mode bits can be interpreted as follows:

  r   (read)
(read) stands for the ability to read the table of contents of the given directory,
  w (write) stands for the ability to write the table of contents of the given directory (create new files,
folders; rename, delete existing files, folders) if and only if  execute
 execute bit is set. Otherwise this
permission is meaningless.
  x (execute) stands for the ability to enter the given directory with command cd and access files,
folders in that directory.

ENGR. M SHUMRAIZ SHARIF 7 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

1. List Files using ls with no option


ls with no option list files and directories in bare format where we won’t be able to view details like
ls with
file types, size, modified date and time, permission and links etc.
# ls 

0001.pcap Desktop Downloads index.html


install.log.syslog Pictures Templates
anaconda-ks.cfg Documents fbcmd_update.php install.log
Music Public Videos
2 List Files With option –l
Here, ls -l (
-l (-l
-l is
 is character not one) shows file or directory, size, modified date and time, file or folder
name and owner of file and it’s permission.
# ls -l 

total 176
-rw-r--r--.
-rw-------. 1
1 root
root root
root 683
1586 Aug
Jul 19
31 09:59
02:17 0001.pcap
anaconda-ks.cfg
anaconda-ks. cfg
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Desktop
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Documents
drwxr-xr-x. 4 root root 4096 Aug 16 02:55 Downloads
-rw-r--r--. 1 root root 21262 Aug 12 12:42 fbcmd_update.php
-rw-r--r--. 1 root root 46701 Jul 31 09:58 index.html
-rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log
-rw-r--r--. 1 root root 11439 Jul 31 02:13
install.log.syslog
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Music
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Pictures
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Public
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Templates
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Videos
3. View Hidden Files
List all files including hidden file starting with ‘.
‘.‘.
# ls -a 

. .bashrc Documents .gconfd


install.log .nautilus .pulse-cookie
.pulse-cookie
.. .cache Downloads .gnome2
install.log.syslog .netstat.swp .recently-used.xbel

0001.pcap
.kde .config
.opera .elinks .spice-vdagent
.gnome2_private
.gnome2_priv
.spice-vdag ent ate

ENGR. M SHUMRAIZ SHARIF 8 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

anaconda-ks.cfg
anaconda-ks.cfg .cshrc .esd_auth .gtk-bookmarks
.gtk-bookmarks
.libreoffice
.libreoffice Pictures .tcshrc
.bash_history
.bash_histor y .dbus .fbcmd .gvfs
.local .pki Templates
.bash_logout
.bash_logout Desktop fbcmd_update
fbcmd_update.php
.php .ICEauthori
.ICEauthority
ty
.mozilla Public Videos

.bash_profil
.bash_profile
Music e .digrc
.pulse .gconf .wiresharkindex.html
4. List Files with Human Readable Format with option -lh
With combination of -lh
-lh option,
 option, shows sizes in human readable format.
# ls -lh 

total 176K
-rw-r--r--. 1 root root 683 Aug 19 09:59 0001.pcap
-rw-------. 1 root root 1.6K Jul 31 02:17 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Desktop
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Documents
drwxr-xr-x. 4 root root 4.0K Aug 16 02:55 Downloads
-rw-r--r--. 1 root root 21K Aug 12 12:42 fbcmd_update.php
fbcmd_update .php
-rw-r--r--. 1 root root 46K Jul 31 09:58 index.html
-rw-r--r--. 1 root root 48K Jul 31 02:17 install.log
-rw-r--r--. 1 root root 12K Jul 31 02:13
install.log.syslog
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Music
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Pictures
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Public
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Templates
drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Videos
5. List Files and Directories with ‘/’ Character at the end
Using -F
-F option
 option with ls
ls command,
 command, will add the ‘/’
‘/’ Character
 Character at the end each directory.
# ls -F 

0001.pcap Desktop/ Downloads/ index.html


install.log.syslog Pictures/ Templates/
anaconda-ks.cfg Documents/ fbcmd_update.php install.log
Music/ Public/ Videos/
6. List Files in Reverse Order
The following command with ls -r  option
 option display files and directories in reverse order.
# ls -r 

ENGR. M SHUMRAIZ SHARIF 9 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

Videos Public Music install.log


fbcmd_update.php Documents anaconda-ks.cfg
Templates Pictures install.log.syslog index.html
Downloads Desktop 0001.pcap
7. Recursively list Sub-Directories

ls -R option
# -R
ls option
-R   will list very long listing directory trees. See an example of output of the command.

total 1384
-rw-------. 1 root root 33408 Aug 8 17:25
anaconda.log
-rw-------. 1 root root 30508 Aug 8 17:25
anaconda.program.log

./httpd:
total 132
-rw-r--r-- 1 root root 0 Aug 19 03:14 access_log
-rw-r--r--. 1 root root 61916 Aug 10 17:55 access_log-
20120812

./lighttpd:
total 68
-rw-r--r-- 1 lighttpd lighttpd 7858 Aug 21 15:26
access.log
-rw-r--r--. 1 lighttpd lighttpd 37531 Aug 17 18:21
access.log-20120819

./nginx:
total 12
-rw-r--r--. 1 root root 0 Aug 12 03:17 access.log
-rw-r--r--. 1 root root 390 Aug 12 03:17 access.log-
20120812.gz
8. Reverse Output Order
With combination of -ltr  will
 will shows latest modification
modification file or directory date as last.
# ls -ltr 

total 176
-rw-r--r--. 1 root root 11439 Jul 31 02:13
install.log.syslog
-rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log
-rw-------. 1 root root 1586 Jul 31 02:17 anaconda-ks.cfg
anaconda-ks. cfg
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Desktop

ENGR. M SHUMRAIZ SHARIF 10 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Videos


drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Templates
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Public
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Pictures
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Music
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Documents

-rw-r--r--. 1
-rw-r--r--. 1 root
root root
root 21262
46701 Aug
Jul 12
31 12:42
09:58 fbcmd_update.php
index.html
drwxr-xr-x. 4 root root 4096 Aug 16 02:55 Downloads
-rw-r--r--. 1 root root 683 Aug 19 09:59 0001.pcap
9. Sort Files by File Size
With combination of -lS
-lS displays
 displays file size in order, will display big in size first.
# ls -lS 

total 176
-rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log
-rw-r--r--. 1 root root 46701 Jul 31 09:58 index.html
-rw-r--r--. 1 root root 21262 Aug 12 12:42 fbcmd_update.php
-rw-r--r--. 1 root root 11439 Jul 31 02:13
install.log.syslog
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Desktop
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Documents
drwxr-xr-x. 4 root root 4096 Aug 16 02:55 Downloads
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Music
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Pictures
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Public
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Templates
drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Videos
-rw-------. 1 root root 1586 Jul 31 02:17 anaconda-ks.cfg
anaconda-ks. cfg
-rw-r--r--. 1 root root 683 Aug 19 09:59 0001.pcap
10. Display Inode number of File or Directory
We can see some number printed before file /
file / directory
 directory name. With -i
-i options
 options list file /
file /directory
directory with
inode number.
# ls -i 

20112 0001.pcap 23610 Documents 23793


index.html 23611 Music 23597 Templates
23564 anaconda-ks.
anaconda-ks.cfg
cfg 23595 Downloads 22
install.log 23612 Pictures 23613 Videos
23594 Desktop 23585 fbcmd_update.
fbcmd_update.php
php 35
install.log.syslog
install.log. syslog 23601 Public

ENGR. M SHUMRAIZ SHARIF 11 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

11. Shows version of ls command


Check version of ls command.
# ls --version 

ls (GNU coreutils) 8.4


Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and
redistribute
redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Richard M. Stallman and David MacKenzie.
12. Show Help Page
List help page of ls command with their option.
# ls --help 

Usage: ls [OPTION]... [FILE]...


13. List Directory Information
With ls -l command
-l command list files under directory /tmp
directory /tmp.. Wherein with -ld
-ld parameters
 parameters displays information
of /tmp
of /tmp directory.
 directory.
# ls -l /tmp  
total 408
drwx------. 2 narad narad 4096 Aug 2 02:00
CRX_75DAF8CB7768
-r--------. 1 root root 384683 Aug 4 12:28 htop-
1.0.1.tar.gz
drwx------. 2 root root 4096 Aug 4 11:20 keyring-
6Mfjnk
drwx------. 2 root root 4096 Aug 16 01:33 keyring-
pioZJr
drwx------. 2 gdm gdm 4096 Aug 21 11:26 orbit-gdm
drwx------. 2 root root 4096 Aug 19 08:41 pulse-
gl6o4ZdxQVrX
drwx------. 2 narad narad 4096 Aug 4 08:16 pulse-
UDH76ExwUVoU
drwx------. 2 gdm gdm 4096 Aug 21 11:26 pulse-
wJtcweUCtvhn
-rw-------. 1 root root 300 Aug 16 03:34 yum_save_tx
yum_save_tx--
2012-08-16-03-34LJTAa1.yumtx
# ls -ld /tmp/ 

drwxrwxrwt. 13 root root 4096 Aug 21 12:48 /tmp/

ENGR. M SHUMRAIZ SHARIF 12 | P a g e  


 

ABBAS COLLEGE OF TECHNOLOGY LAHORE. 03404088566

14. Display UID and GID of Files


To display UID
UID and
 and GID
GID of
 of files and directories. use option -n
-n with
 with ls command.
# ls -n 

total 36
drwxr-xr-x. 2 500 500 4096 Aug 2 01:52 Downloads
drwxr-xr-x. 2 500 500 4096 Aug 2 01:52 Music
drwxr-xr-x. 2 500 500 4096 Aug 2 01:52 Pictures
-rw-rw-r--. 1 500 500 12 Aug 21 13:06 tmp.txt
drwxr-xr-x. 2 500 500 4096 Aug 2 01:52 Videos
15. ls command and it’s Aliases
We have made alias for ls ls command,
 command, when we execute ls command it’ll take -l
-l option
 option by default and
display long listing as mentioned earlier.
# alias ls="ls -l" 
Note: We can see number of alias available in your system with below alias command and same
Note:
can be unalias as shown below example.
# alias 

alias cp='cp -i'


alias l.='ls -d .* --color=aut
--color=auto'
o'
alias ll='ls -l --color=auto'
alias ls='ls --color=aut
--color=auto'
o'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias
--show-dot --show-tilde
--show-tilde'
'
To remove an alias previously defined, just use the unalias command.
# unalias ls 
In our next article we’ll cover up more or advanced ls
ls command
 command with their examples. If we’ve missed

anything in the list, please update us via comment section.

ENGR. M SHUMRAIZ SHARIF 13 | P a g e  

You might also like