Fedora Terminal Commands
Fedora Terminal Commands
Fedora Terminal Commands
gunzip abc.tar.gz; tar xf abc.tar = unzips then untars a file (two steps)
hal-device-manager = opens a gui for hardware profiling
head -6 .bash_history = first 6 commands
head -5 filename.txt = prints first 5 lines of the file
head -n 5 filename.txt = prints first 5 lines of the file
history 5 = last five commands
history | wc -l = total history commands
history | grep rpm = search through history for rpm commands
history = list of all commands used so far
hostname = name of the host
hwclock show = prints today's date and time
hwclock set date =2/22/2008 12:25:30 = reset new time and date
identify imagename.jpg = gives image info
identify -verbose imangename.jpg | less = gives info about image
identify -verbose imangename.jpg | more = gives more info about image
id = info about user/root's groupid/uid etc
ifconfig = network card info, ipaddress etc.
ifconfig -a = available network cards
info coreutils = info about core commands
iostat 3 = checks disk reads
iostat -c 3 = updates cpu usage
iostat -c -t = cpu usage with time
iostat -c -t 2 10 = repeat cpu usage info every 2 seconds 10 times
ip a = available network interfaces
ip addr = ip addresses by method of connection ie ppp0
ip addr show eth0 = ip address for ethernet connection
ip calc -bnm 192.168.0.1/27 = displays netmast ip from CIDR
ip route = checks routing table
isoinfo = info about iso
iwconfig = checks for wireless connection
iwlist = checks for a wireless access point
kded version = kde version
kde-config version = kde version
kill 23456 = kills process with id 23456
kill -9 1234 = sends SIGKILL to id 1234
kill -SIGCONT 1234 = sends SIGCONT to id 1234
kill 4% = kills the process represented by 4% job
kill sttd = kills all sttd daemons running
last = last log in details
lastlog [-u root] = last log in time
last [root] = entire log in history, the feature needs to be activated first
lastb [root] = prints failed login attempts
less filename.txt = prints contents of the file, scroll bar fixed, Press q to quite and spacebar to go to another
page
less filename.txt = prints contents of the file, scroll bar fixed, press spacebar
less filename /word = searches for word
ln -s originalfile newfile = creates a symbolic link to new file
locate xyz = locates file xyz case-sensitive
locate -i xyz = locates file xyz not case-sensitive
locate -r /ls$ = locates files ending in /ls
locate -r james*bond = locate files with james and bond in their names
locate -r ^ boot/grub/me = locate files beginning with boot/grub/me
locate *.jpg > Desktop/myjpgs.txt = stores results of search in a file named myjpgs.txt
lsmod = lists kernel modules installed
lsmod | sort -k 2,2n = sorts kernel modules in increasing size order
ls /var/www/html/*.html = lists all html files
ls .??* = lists all directory names that start with a dot .
ls /etc/rc.d = prints all directories for all available run levels
ls /etc/rc.d/init.d = list of system services' scripts
ls -l = lists files and folders in the current directory
ls -la = lists hidden files and folders in the current directory with a dot
ls li = files with their inodes
ls -lt = files recently modified
ls -lu = lists files by their accss time
ls -ln = user names and groups numerically displayed
ls -lh = human readable file sizes
ls -lR = displays all the files and their folders
ls -F = lists files by type
ls -c = lists files columnwise
ls color =always = shows filenames in colors
ls -l /var/lib/rpm = rpm database
ls = lists contents of a directory
ls . = lists contents of a directory
ls .. = lists contents of a directory
ls / = lists all system directories
ls = lists directories in current directory
ls /var = lists all subdirectories under the /var directory
ls /proc | wc -l = number of subdirectories in /proc directory
ls -ltr =
ls -l filename.ext = checks permissions for a file
ls -l /etc = permission status of all subdirectories
ls -a = shows hidden . Dot directories. A kind of special configuration files not be messed with
ls tr | '\n' ' ' = replaces all newline characters with spaces
ls tr | -d '\n' = deletes newlines
ls /var/lib/mysql = list of databases in blue color
lsof = list of open directories and files
lsof -c bash = list of files open by bash shells
lsof -d cwd = list of directories open as current working directory
lsof -u james = list of files and directories open by user james
lsof /mnt/sda1 = list of anything open on /mnt/sda1 file system
rpm2cpio xyz.rpm > xyz.cpio = extracts cpio archive from rpm package
rpm2cpio xyz.rpm | cpio -tv = lists the contents of archive
rpm -e xyz = removes package xyz
rpm -e nodeps xyz-5.6.fc5.i386 = removes 32+ bit version of package if more versions available
rpm -ivh xyz.rpm = install package xyz (i=install, v=verbose, h=hash)
rpm -ivh http://ftp.abc.com/xyz.rpm = install package xyz from the site
rpm -Uvh xyz.rpm = update package xyz (U=update)
rpm -q --scripts kernel |less = list of all preinstall & post-install scripts
rpm -q php = php version no.
rpm -qi php = php install info
rpm -qi fedora-release = Fedora installation info
rpm -qi php/per/python/ruby = version info for the package
rpm -qa grun = prints grub version no.
rpm -qa php = prints php version no.
rpm -qa | sort | pr column=2 | less = shows installed packages in 2 columns per page
rpm -qa | sort | pr column=2 > abc.txt = saves output to a file
rpm -qa | sort | pr column=2 | lpr = sends output to a printer
rpm -qa | grep kernel | sort = sorts installed packages in alphanumeric order
rpm -qa | grep kernel | sort -r = sorts in reverse alphanumeric order
rpm -qa | grep php = prints version nos. of all php related packages
rpm -qa | head = only 10 softwares listed
rpm -qa | head -n5 = first 5 software listed
rpm -qa | wc -l = total no of packages installed on the system
rpm -ql php = lists all files in a particular package
rpm -qal | grep php = find php in all installed packages
rpm -ql php | wc -l = total no. of files in a particular package
rpm -qa | grep php | wc -l = count the total number of php modules
rpm -qf /var/lib/php = what package a particular file belongs to
rpm -q --scripts mysql = scripts of a package
rpm -qa php | wc -l = total no. of php packages
rpm -qi php = info about php
rpm -q last php = installation date of php
rpm -qi php | grep -i vendor = php vendor name
rpm -qi fedora-release | grep -i vendor = prints vendor name from a file named fedora-release
rpm -v = rpm version
rpm -qa --queryformat '%{NAME}==%{VENDOR}\n' | grep -v "Red Hat" | sort = list of installed packages
with their vendor names except Red Hat
rpm -qa --qf '%{NAME}==%{VENDOR}\n' | grep "Red Hat" | sort = list of installed packages with their
vendor name as Red Hat
rpm -qa --qf '%{NAME}==%{VENDOR}\n' | sort = list of installed packages with their vendor names
rpm -qa --qf '%{NAME}==%{VENDOR}\n' | grep "Red Hat" | wc -l = total number of installed packages with
Red Hat as their vendor
rpm -qa --qf '%{NAME}==%{LICENSE}\n' | sort = list of all installed packages with their licence type sorted
alphabetically
rpm -qa --qf '%{NAME}==%{LICENSE}\n' | wc -l = total number of installed packages with their licence type
rpm -qa --qf '%{NAME}==%{LICENSE}\n' | grep php | sort = list of all php packages with their licence types
sorted alphabetically
rpm -qa --qf '%{NAME}==%{LICENSE}\n' | grep php | wc -l = total number of all php packages with their
licence types
rpm -qa --qf '%{NAME}==%{SIZE}\n' | sort = list of all installed packages with their names and sizes in bytes
sorted alphabetically
rpm -qa --qf '%{NAME}==%{SIZE}\n' | grep php | sort = list of all php packages with their names and sizes in
bytes sorted alphabetically
rpm -qa --qf '%{NAME}==%{SIZE}\n' | grep php | wc -l = total number of installed php packages with their
names and sizes in bytes
rpm -qa --qf '%{NAME}==%{SUMMARY}\n' | sort = list of all installed packages with their names and
functions sorted alphabetically
rpm -qa --qf '%{NAME}==%{SUMMARY}\n' | grep php | sort = list of all php packages with their names and
functions sorted alphabetically
rpm -qa --qf '%{NAME}==%{SUMMARY}\n' | grep php | wc -l = total number of all php packages with their
names and functions
rpm -qa --qf '%{NAME}==%{BUILDHOST}\n' | sort = list of all installed packages with their names and
buildhosts sorted alphabetically
rpm -qa --qf '%{NAME}==%{BUILDHOST}\n' | grep php | sort = list of all php packages with their names
and buildhosts sorted alphabetically
rpm -qa --qf '%{NAME}==%{BUILDHOST}\n' | grep php | wc -l = total number of all php packages with
their names and buildhosts
rpm -qa --qf '%{NAME}==%{URL}\n' | sort = list of all installed packages with their names and urls sorted
alphabetically
rpm -qa --qf '%{NAME}==%{URL}\n' | grep php | sort = list of all php packages with their names and urls
sorted alphabetically
rpm -qa --qf '%{NAME}==%{URL}\n' | grep php | wc -l = total number of all php packages with their names
and urls
rpm -qa --qf '%{NAME}==%{ARCH}\n' | sort = list of all installed packages with their names and architecture
type sorted alphabetically
rpm -qa --qf '%{NAME}==%{ARCH}\n' | grep php | sort = list of all php packages with their names and
architecture type sorted alphabetically
rpm -qa --qf '%{NAME}==%{ARCH}\n' | grep php | wc -l = total number of all php packages with their names
and architecture type
rpm querytags = list of all rpm query tags
rpm querytags | wc -l = total number of rpm tags
rpm -Va = verify all installed packages
rpm -Va | grep php = verify php packages only
rpm -Vv | grep php = check php packages only with verbose
root = superuser, who has permission to do anything
/root = root account's home directory
sha1sum xyz.iso = checksum verification
stat filename = prints access/modification right to a file
set = list of all enviornmental variables
set | wc -l = total number of enviornmental variables
Important commands
ECHO command
echo $SHELL = prints the default shell name
echo $OSTYPE = prints the operating system name
echo 'text' = prints what is held in the quotes
echo $HOME = prints home directory
echo $USER = who is currently using the system
echo $HISTFILE = location of history file
echo $HISTFILESIZE = history's set size
echo $HISTSIZE = history's set size
echo test | mail -v -s test xyz@abc.com = sending e-mail from a terminal
Posted by james at No comments:
MAN command
man -f php = info about php modules
man -k php = info about php modules
man php = php manual pages
man man = info about manual pages and their format
man 3 php = shows entries for php in 3rd section of the manual
man php | grep word = searches for a particular word in php manual
man hier = info about directories
Posted by james at 1 comment:
LSPCI command
lspci = info about pci devices/ports
lspci | grep VGA = graphics card info
lspci | grep audio = audio card info
lspci | grep -i modem = modem info
lspci | grep -i usb = usb ports info
lspci | grep -i ethernet = ethernet card info
Posted by james at No comments:
LS command
ls /var/www/html/*.html = lists all html files
ls .??* = lists all directory names that start with a dot .
ls /etc/rc.d = prints all directories for all available run levels
ls /etc/rc.d/init.d = list of system services' scripts
ls -l = lists files and folders in the current directory
ls -la = lists files and folders in the current directory with a dot
ls li = files with their inodes
ls -lt = files recently modified
ls -lu = lists files by their accss time
ls -ln = user names and groups numerically displayed
LOCATE command
locate xyz = locates file xyz case-sensitive
locate -i xyz = locates file xyz not case-sensitive
locate -r /ls$ = locates files ending in /ls
locate -r james*bond = locate files with james and bond in their names
locate -r ^ boot/grub/me = locate files beginning with boot/grub/me
locate *.jpg > Desktop/myjpgs.txt = stores results of search in a file named myjpgs.txt