vi /etc/default/login
#console=/dev/console -> console=/dev/console
Unarchive files
zcat ./archive.tar.Z | tar xvf -
gzcat ./archive.tar.gz | tar xvf -
gunzip inf_sign archive.tar.gz | tar xvf -
Solaris : Display current run level
who -r
run level S Jan 17 12:13 S 1 3
S is the current run level. 1 is the number of times at run level S since last reboot. 3 is the previous run level.
rsh myremotehost mt -f /dev/rmt/0 rewind
rsh myremotehost mt -f /dev/rmt/0cn fsf 5 : cn means Compression No rewind.
fsf 5 will go the the 5th backup
ufsrestore bivf 128 myremotehost:/dev/rmt/0 : will restore files from the
tape in myremotehost to the current dir. Then we use some commands : add,
extract and quit.
rsh between 2 hosts
if mycomputer needs to send rsh command to myserver with root user :
Log to myserver and perform the following tasks :
create /.rhosts and add hostname "mycomputer"
edit /etc/hosts and add hostname ip -> "mycomputer
111.222.333.444"
See which version of file we're using
which filename
/dir1/dir2/filename
AIX : Show tape drive config
lscfg -vl rmt0
mt -f /dev/rmt0 status
Sendmail : send a test message
sendmail -v username "minus
sign"/dev/null
Display process info
Linux : ps -eo "%p %P %y %U %C %c %x
%z" | sort +4 -r | more
Solaris : ps -A -o pid,fname,user,pcpu,rss,vsz,etime,ppid,comm,s
Solaris : ps -A -o pid=PID -o user=OWNER -o etime=STARTED -o s=STATE ....
AIX : Which fileset is not up to date
oslevel -l 4.3.3.0
vi : replacing all instances of textA with testB
:g/textA/s//textB/g
Date : playing with format
date -> 24 08 2000
date "+%s" -> 967140091
date -d '1970-01-01 967140091 sec' "+%d %m %Y" -> 24 08 2000
SAMBA
Mounting an NT share on a linux box :
mount -t smbfs -o
username=myNTusername,password=myNTpassword,
uid=myUNIXusername,gid=myUNIXgroup
//myNTserver/directory /mnt/mymountpoint
Removing all blank characters at beginning of all lines
:g/^ */s///g
page down
<CTRL>F
Infos sur le fichier et la position du curseur
<CTRL>G
substitution de TOTO par TITI
:g/TOTO/s//TITI/g
Affichage des numeros de ligne
:set number
Masquer les numeros de ligne
:set nonumber
inserer avant la position courante du curseur
i
inserer apres la position courante du curseur
a
inserer au debut de la ligne courante
I
Renaming all files in dir :
let index=1;for i in `ls photo*`
do if [[ $index -lt 10 ]] then cp $i
Pictures00$index.jpg else if [[ $index -lt
100 ]] then cp $i
Pictures0$index.jpg else cp $i Pictures$index.jpg fi fi
let index=index+1
done