Commands: Difference between revisions

From Halfface
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
==man==
man correct caracters.
man correct caracters.
  LANG=C man passwd
  LANG=C man passwd
Line 5: Line 6:
  man [manual] | col -b > file.txt
  man [manual] | col -b > file.txt


==puppet==
set up tunnel
set up tunnel
  putty -l bjorklun -pw password -L 19242:192.168.0.42:3389 blt.homeip.net
  putty -l bjorklun -pw password -L 19242:192.168.0.42:3389 blt.homeip.net


copy mbr
==mbr==
  dd if=/dev/hda of=/dev/fd0 bs=512 count=1
backup mbr.
  # dd if=/dev/sdX of=/temp/sdx-mbr bs=512 count=1


restore mbr
# dd if=/temp/sdx-mbr of=/dev/sdX bs=446 count=1
==numbers==
series of numbers
series of numbers
  bash:
  bash:
Line 16: Line 23:
  for ((a=100;a <= 199 ;a++)); do echo "$a"; done | cut -b2-3
  for ((a=100;a <= 199 ;a++)); do echo "$a"; done | cut -b2-3


==rpm==
install src.rpm
install src.rpm
  rpmbuild --rebuild alien-6.51-1.src.rpm
  rpmbuild --rebuild alien-6.51-1.src.rpm
Line 26: Line 34:
  rpm2cpio *.rpm | cpio -i --make-directories
  rpm2cpio *.rpm | cpio -i --make-directories


==clean==
Clean file from comments and blank lines.
Clean file from comments and blank lines.
  sed '/ *#/d; /^ *$/d'
  sed '/ *#/d; /^ *$/d'
Line 32: Line 41:
  servicepack.exe -s:z:\w2k3
  servicepack.exe -s:z:\w2k3


==rsync==
Syncronize folders.
Syncronize folders.
  rsync --delete -az -e ssh acrobatreader acdse office2003 java nortonantivirus bjorklun@semco.homeip.net:/install/program/windows/
  rsync --delete -az -e ssh acrobatreader acdse office2003 java nortonantivirus bjorklun@semco.homeip.net:/install/program/windows/


==crontab==
crontab.
crontab.
  * * * * *  command to be executed
  * * * * *  command to be executed
Line 52: Line 63:
  6 Saturday  
  6 Saturday  


==ssh==
Automated login on a user basis via ssh.
Automated login on a user basis via ssh.
  ssh-keygen -t dsa                    Generate personal ssh keys.
  ssh-keygen -t dsa                    Generate personal ssh keys.
Line 69: Line 81:
  }
  }


reboot
==reboot==
  Hard reboot mean that shutdown scripts will not run and machine reboot immediately without syncing hard disk drives, shutdown applications etc.
  Hard reboot mean that shutdown scripts will not run and machine reboot immediately without syncing hard disk drives, shutdown applications etc.
  echo 1 > /proc/sys/kernel/sysrq
  echo 1 > /proc/sys/kernel/sysrq
Line 82: Line 94:
  ffmpeg -y -deinterlace -aspect 16:9 -author "Andreas Bjorklund" -title "Tanzania" -year 2007 -i Tanzania.m2t -acodec mp3 -vcodec mpeg4 -b 3000k -s 720x540 test.avi
  ffmpeg -y -deinterlace -aspect 16:9 -author "Andreas Bjorklund" -title "Tanzania" -year 2007 -i Tanzania.m2t -acodec mp3 -vcodec mpeg4 -b 3000k -s 720x540 test.avi


==logging==
bash create log.
bash create log.
  #!/bin/bash
  #!/bin/bash
Line 88: Line 101:
  exec 2>/tmp/log
  exec 2>/tmp/log


==rename==
rename series.
rename series.
  for i in *; do mv "$i" "`basename $i .mpg`bajs.mpg"; done
  for i in *; do mv "$i" "`basename $i .mpg`bajs.mpg"; done


==ntfs-3g==
mount ntfs filesystem. read and write.
mount ntfs filesystem. read and write.
  yum install fuse fuse-libs ntfs-3g
  yum install fuse fuse-libs ntfs-3g
Line 99: Line 114:
  /dev/sda1  /media/c_drive    ntfs-3g    rw,defaults,umask=0000 0 0
  /dev/sda1  /media/c_drive    ntfs-3g    rw,defaults,umask=0000 0 0


==mplayer==
mplayer in ascii mode.
mplayer in ascii mode.
  mplayer -monitoraspect 4:3 -vo aa LinaFreestyler.avi
  mplayer -monitoraspect 4:3 -vo aa LinaFreestyler.avi


==vi==
vi command:
vi command:
  :set ignorecase
  :set ignorecase


==codepage==
Change codepage of file.
Change codepage of file.
  convmv -f cp850 -t iso-8859-1 --notest *
  convmv -f cp850 -t iso-8859-1 --notest *
  convmv -f utf8 -t iso8859-1 -r --notest *
  convmv -f utf8 -t iso8859-1 -r --notest *

Revision as of 06:03, 13 November 2007

man

man correct caracters.

LANG=C man passwd

man clean for output to file.

man [manual] | col -b > file.txt

puppet

set up tunnel

putty -l bjorklun -pw password -L 19242:192.168.0.42:3389 blt.homeip.net

mbr

backup mbr.

# dd if=/dev/sdX of=/temp/sdx-mbr bs=512 count=1

restore mbr

# dd if=/temp/sdx-mbr of=/dev/sdX bs=446 count=1

numbers

series of numbers

bash:
Get a list from 01 to 99.
for ((a=100;a <= 199 ;a++)); do echo "$a"; done | cut -b2-3

rpm

install src.rpm

rpmbuild --rebuild alien-6.51-1.src.rpm
rpm -i /usr/src/redhat/RPMS/x86_64/alien-6.51-1.rpm

List contents of rpm.

rpm -qlp myfile.rpm

Extract contents of rpm.

rpm2cpio *.rpm | cpio -i --make-directories

clean

Clean file from comments and blank lines.

sed '/ *#/d; /^ *$/d'

Update release area Windows.

servicepack.exe -s:z:\w2k3

rsync

Syncronize folders.

rsync --delete -az -e ssh acrobatreader acdse office2003 java nortonantivirus bjorklun@semco.homeip.net:/install/program/windows/

crontab

crontab.

* * * * *  command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
0 Sunday
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday 

ssh

Automated login on a user basis via ssh.

ssh-keygen -t dsa                    Generate personal ssh keys.
cat id_dsa.pub >> authorized_keys2   Copy your personal ssh key to all machines.
chmod 644 ~/.ssh/authorized_keys2    Verify correct access on files.

-forward traffic.

service x11
{
        disable = no
        socket_type = stream
        protocol = tcp
        wait = no
        user = root
        server = /usr/bin/nc
        server_args = 172.28.37.152 6000
}

reboot

Hard reboot mean that shutdown scripts will not run and machine reboot immediately without syncing hard disk drives, shutdown applications etc.
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
This commands enable sysrq and after this call fast reboot. If you want to force shutdown machine try this.

Force shutdown

echo 1 > /proc/sys/kernel/sysrq 
echo o > /proc/sysrq-trigger

ffmpeg

ffmpeg -y -deinterlace -aspect 16:9 -author "Andreas Bjorklund" -title "Tanzania" -year 2007 -i Tanzania.m2t -acodec mp3 -vcodec mpeg4 -b 3000k -s 720x540 test.avi

logging

bash create log.

#!/bin/bash
exec > /logfile

alternative

exec 2>/tmp/log

rename

rename series.

for i in *; do mv "$i" "`basename $i .mpg`bajs.mpg"; done

ntfs-3g

mount ntfs filesystem. read and write.

yum install fuse fuse-libs ntfs-3g
mount /dev/sda1 /media/c_drive -t ntfs-3g -r -o umask=0222,locale=en_US
mount /dev/sda1 /media/c_drive -t ntfs-3g -rw -o umask=0000,locale=en_US
fstab read and write.
/dev/sda3   /media/e_drive     ntfs-3g    ro,defaults,umask=0222 0 0
/dev/sda1   /media/c_drive     ntfs-3g    rw,defaults,umask=0000 0 0

mplayer

mplayer in ascii mode.

mplayer -monitoraspect 4:3 -vo aa LinaFreestyler.avi

vi

vi command:

:set ignorecase

codepage

Change codepage of file.

convmv -f cp850 -t iso-8859-1 --notest *
convmv -f utf8 -t iso8859-1 -r --notest *