alias - View defined alias (Unix)
bg - Put a process in background. Press [Ctrl]-[z] from terminal to froze process, and then type bg.
cat /dev/null > s.sql - Empty an existant file, space is immediately released and subsiquent writes are discarded
cd - #switch to previously working dir
chkconfig (Linux RedHat)
chkconfig --del sendmail #configuration file is not deleted, ex.: /etc/init.d/dbora
chkconfig --level 2345 sendmail off #disable sendmail for the specified runlevels
See Automate database Startup/Shutdown
#You can manually start a service, for example to start nfs:
#/etc/init.d/nfs start
chmod 4511 filename - (4)setuid bit, this settings make the file as root but read only for all
chown oracle:dba oracle - Set ownership of directory oracle to user oracle and group dba
#change also subfolders
chown -R oracle:dba oracle
cpuinfo - /proc/cpuinfo display CPU infos (Linux)
cut
#displays all the users and the corresponding UIDs from the /etc/passwd file separated by a : field delimiter
-d: -f 1,3,8 /etc/passwd
#save the name of all the users in your system in alphabetical order to a newfile file after removing the
#duplicate entries
cut -f1 -d: /etc/passwd | sort -d | uniq > newfile
date - date +%Y%m%d_%H%M%S (Unix)
dd if=/dev/hda of=/dev/hdb - Copy one disk to another, do not create partitions on destination they will be copied too
dd if=/dev/zero of=/dev/raw/raw1 bs=1M count=125 Create a raw file
df
-h - File systems occupation human readable (Linux)
-k - File systems occupation in Kbytes (Unix)
dmesg - Display OS messages (Sun Solaris)
du
-k - See how much space current directory occupies, listing each driectory
-s - See how much space current directory occupies, listing only grand total
du -k --max-depth=2 Only 1 level depth (Linux RedHat)
echo #See Backslash Escaped Characters in Scripts
-e #
echo -e "1\r\n2\n3"
------
1
2
3
env - View environment variables (Unix)
file - report the type of file By examining the file contents and By examining magic numbers that occur
at specific offsets and matching them against known file types.
Also report 32/64 bit architecture
find
find / -name 'bin' 2>&1 |grep -v 'find: cannot read dir /lost+found'
#A list of all the regular files with the extension .jpg and owned by the user john, under the /home directory and
#subdirectories
find /home/ -name *.jpg -type f -user john
#Locate all the files named prg.conf in the current working directory and its subdirectories and add read
#permission for others.
find . -name "prg.conf" -exec chmod o+r '{}' \;
-print #default action
-ls #display full details
-exec #run a command on find match
-ok #remaind a confirmation prompt
ftp lftp ftp.server1.example.com/pub/> get newbackup
free show free memory (Linux)
fuser -c /oradata/aldo - See who is locking directory or file (IBM AIX)
glance - Payment version of 'top' (Hp)
grep Recursive: /usr/bin/find . -name \*.ksh | /usr/bin/xargs /usr/bin/grep -i "dba.support@fastweb.it"
gzip -r - Zip a directory
id - See current user (Unix) and group informations
iostat
Please remember that "sy" means "system" and that is an I/O wait
Sun Solaris
iostat -xtcM -l40 3 - Extended I/O and CPU details of current activity
iostat -xtcMz -l30 3 - Only show active devices
iostat -xtcM 10 | grep -v "0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0"
HP-UX B.11.11
iostat -t 3 - Reduced version
Linux
iostat -tx 2 - Version for(Linux RedHat4)
iostat -mntx 2 - Version for(Linux RedHat5)
iostat sda -tx 2 - to limit output
isainfo -kv - Os bit(32/64) (Solaris)
ldd /app/oracle/bin/oracle|grep "not found" #prints the shared libraries required by a program
lsof -i -P | grep 6100 - Show process holding port 6100 (HP)
ln -s /fal_pro/FAL_PRO/pfile/orapwFAL_PRO orapwFAL_PRO - create a link
ls -l --color=tty - List files
mailx - See dedicated section Various tips
md5sum -b pippo.txt - Calculate a unique hash code for the file (Unix)
mesg -n - disable message reception via write or talk (Unix)
mkdir -p /a/b/c
mkfile - see How to SWAP, see prealloc
modprobe - Load a kernel module (Linux)
model - Determine cpu type, risc or itanium(ia64) (HP)
mount See How to mount on Linux
mv -t * /oradata/al12 - Move all folders to destination(Linux)
netstat -in - Show functioning ip on host (Unix)
-a - Tcp/Ip statisticics (Unix)
-ao (Windows)
newgrp - Change current user group (Linux)
nohup java -jar -Xrs pippo.jar & - Execute commands in background. Use -Xrs with java
nslookup www.fadalti.com 192.168.0.1 (Windows)
pkill -9 -u smith #kill all processes of user smith
skill -9 -u smith
prealloc delete.me 1048576000 - Same as mkfile(Hp)
prtconf | grep 'Memory size' - Show physical memory (Solaris)
prstat -a - Monitor cpu user activity (Solaris)
prtdiag - /usr/sbin/prtdiag - Show physical memory information, CPU infos and other(Solaris)
ps -ef show running processes(Unix);
/usr/ucb/ps auxwww complete proc name showed(Solaris)
-ely show memory for each process
rdate -s hostname - Synchronize host time with timeserver
read -t5 -n6 -s P
5 seconds given(-t5), to enter up to 6 chars(-n6), with no echo(-s), into variable P
rm -rf pippo
-use unlink to delete links
rpm
#Erase/Uninstall a package(Linux RedHat)
-e <package name> --nodeps
#Find the package containing the specified file
-qf <filename>
#It shows all the packages on which the querying package depends
-qR
#informations about the package
-qi
#List all packages
-qa
#Show rpm content files
-qpl <rpm>
#Install a package
-iv <pck>
#Install force replacing any distubing
-iv --replacepkgs --force --replacefiles --nodeps <pck>
#Upgrades only if an earlier version exists installed
-F
#
-Va sendmail
S.5....T c /etc/mail/sendmail.cf
S.?....T c /var/log/mail/statistics
**** Create an installable RPM from a source RPM (on RedHat) ****
#populate SOURCES and SPECS
rpm -ivh <pck>
cd /usr/src/redhat/SPECS
rpmbuild -bp gcc34.spec
rpmbuild -bc --short-circuit gcc34.spec
rpmbuild -bi --short-circuit gcc34.spec
#you may just issue this last with no --short-circuit
rpmbuild -bb --short-circuit gcc34.spec
cd /usr/src/redhat/RPMS/i386
****
rpmbuild --rebuild sendmail-8.12.8-9.80.src.rpm #It does both the compilation and installation of the binary software produced from the sendmail source
scstat tipically in /usr/cluster/bin/scstat, display all info about Sun Cluster (Solaris)
/usr/cluster/bin/scstat | grep online #Quickly show resources location
scp *.log deploy@10.31.132.155:/tmp/
Copy all *.log files to host 10.31.132.155 int /tmp folder.
See ssh - Automatic Connection for no password prompt
sed #replaces
echo pippo | sed s/pippo/fun/g
----
fun
#replace all occurrences of the letter "e" with the letter "y" in file1.txt and save the
#output to fix.txt
sed s/e/y/g file1.txt > fix.txt
or
sed s/e/y/g < file1.txt > ./fix.txt
sensors Shows temperatures of internal components (Linux Ubuntu)
set
View environment variables (Windows)
-o vi - Enable Esc over terminal connections (Unix)
#Manually set shell parameters
set a b c d e
echo ${4}
-----
d
echo ${#}
-----
5
echo ${@}
-----
a b c d e
slocate (Linux)
#Create search database, -l 0 turn security off (1 is default)
slocate -U /data01/app/oracle/product -o /data01/app/oracle/product/slocate.dbf -l 0
#find tnsnames.ora, the database must be updated, you may use the same command for creation
slocate -i -d /data01/app/oracle/product/slocate.dbf names.or
startx start X
/sbin/init 5
xinit
nautilus
Tips:
Use the -X option with ssh while connecting
Set the X11Forwarding parameter to yes in /etc/ssh/sshd_config
strace -o test.out test.sh Trace system calls of a program (Linux)
sudo su - oracle - change user if enabled to
swap -s - See swap space state How to SWAP
ssh
-l oracle 192.169.3.1 - Login to a remote host via ssh
-X oracle@mymachine.fadalti.com - Login to a remote host via ssh and enable X over ssh. No export display required
stty erase ^H - Enable backspace over terminal connections
sysctl /sbin/sysctl -p /etc/sysctl.conf-p /etc/sysctl.conf #Reload kernel parameters(Linux)
tar
-xvf pippo.tar - Decompress a tar
-cvf pippo.tar <directory_name> - Build a tar for a directory set
tee ps -ef|grep pmon|tee mona.txt - Read from stin and write to file(Linux)
time #get time infos for every command passed (Linux)
time dd if=/dev/zero of=testfile bs=16k count=16384
touch -t 0507221706 pippo.txt - Set time YYMMDDHHmm to pippo.txt, file is created if not present
top Show cpu, memory count(manually count rows from CPU) and top process activity.(Hp, Linux)
Please remember that "sy" means "system" and that is an I/O wait
F k - to sort by cpu
1 - to show all cpu state
topas - Monitor activity (IBM AIX)
tr #Translate/convert upper/lower case
echo culo | tr a-z A-Z
tree print directory tree(Linux)
umask 0755 - u=rwx,g=rx,o=rx
uname -a -Display host platform informations; -X CPU count
-m Architecture(32 or 64 bits)
unlink delete links
update-rc add sshd default (Linux Gentoo)
update-rc del sshd
update-rc show
#Adds the sshd script (in /etc/init.d) to the "default" runlevel
#The following apply for Linux Ubuntu:
update-rc.d interfaces.sh defaults
update-rc.d -f interfaces.sh start 99 2 3 4 5 .
update-rc.d -f interfaces.sh remove
usermod
usermod -u 510 oracle #change user id, see also groupmod
usermod -a -G oinstall oracle #add user oracle to group oinstall
vi - text editor. See Various tips
vmstat 4 - Show memory details (free: free memory in kb, sr: scan rate of disk memory. Should be 0)
Use "top" for a quick view only
Normal condition, 100MB ram free, no swap on disk
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 103604 12632 342528 0 0 0 16 1004 119 0 0 100 0
w An extended version of "who" showing also cpu usage(Linux)
wc -l - Use command | wc - l not to let the command wait for user window output to complete,
the total lines number is finally reported
write oracle pts/6 - Write terminal messages to other users, see mesg to disable(Unix)
use "write oracle" to send to all connected oracle users
xargs Trasform a series of new line separated lines:
aaa
bbb
in a single line: aaa bbb
xxd -r
|