Saturday, March 21, 2009

Permissions in Fedora Linux

Permissions:

rwx rwx rwx
1 2 3
u g o

u = user
g = group
o = other
r = read = 4
w = write = 2
x = execute = 1

SERVICE command

service httpd start = starts apache server

service mysqld start = starts mysql server

service --status-all = service status of all the services installed

YUM command

yum clean all =
yum clean headers =
yum clean metadata =
yum clean packagename = clean packages left in cache
yum –enablerepo =livna install mplayer = enable livna repo & install mplayer
yum --disablerepo = livna search php = disable livna repo and search other repos for php
yum groupinfo =
yum grouplist =
yum groupinstall XFCE = installs entire group XFCE
yum groupupdate XFCE = updates for group XFCE
yum list available = lists all packages available for installation
yum list extras – packages not installed from any repo
yum list installed = lists all installed softwares
yum list updates = updates available
yum list updates php = updates available for php
yum localinstall xyz.rpm = installs packages from the HDD or CD/DVD
yum update php/perl/etc = updates packages
yum install php/perl/etc = installs packages
yum install php* = installs all php packages
yum install hwbrowser =
yum install lshw =
yum list php* = lists all php packages
yum remove php = remove php
yum groupremove php = remove entire php group
yum search "php" =
yum whatprovides php =

CAL command for calendar

cal = shows calendar

cal 2009 = shows 2009 calendar

cal -j = prints current month's calendar where days are numbered

cal -m = pritns current month's calendar where Monday is the 1st day

cal -y = prints current year's calendar

cal 12 2005 = prints December month of 2005

GREP command

grep india /usr/share/dict/words = looks for the word 'india' in dictionary
grep “word” filename = prints lines with the “word ” in them
grep -n “word” filename = line numbers with the word in them printed
grep -vn “word” filename = lines without the “word” in them
grep -c “word” filename = total no. of occurrences of “word”
grep -n “word” * = lists all lines from all files that contain “word”
grep -x “word” * = only “word” a line
grep word filename = searchers for the word in the file
grep -i word filename = searchers for the word in the file
grep -i word1 word2 filename = searchers for the word in the file
groups = list of groups

SHUTDOWN command

shutdown -r = reboot

shutdown -0 (Zero) = reboot

shutdown – h = halt

LAST command

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

RPM command

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 | 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

FIND command

find -iname filename.ext = find a file by name
find . = lists all files and subdirectories in the current directory
find . -size +200M = finds files more than 200M in size
find . -size +200M -ls = more details
find . -name *.txt -size +40K = finds .txt file names of more than 40 k in size
find /usr/share/docs | xargs grep -l 'keyword' = finds files that contain the keyword from documents
finger = log in details

UNAME command

uname = operating system name

uname -r = Linux version

uname -o = operating system name

uname -m = system architecture

uname -n = host name

uname -p = processor architecture

uname -s = os name

uname -v = Linux update time

uname –hardware-platform