Linux TIPS







/etc/shells

emacs test.user
hogeuser1:hogepass1:1101:1101:hogeu1:/home/hogeuser:/bin/bash
hogeuser2:hogepass2:1102:1102:hogeu2:/home/hogeuser:/bin/bash2
newusers test.user
emacs test.pass
hoge1:hogepass
hoge2:hogepass2
chpasswd < test.pass

printf "hogepass1\n"|passwd --stdin hoge1
printf "hogepass2\n"|passwd --stdin hoge2

acl

ps auxw -H

ps aux |grep httpd
ps aux |grep [h]ttpd

su

su - hoge

yes

yes | hoge
yes no | hoge

FreeBSD

http://www.jp.freebsd.org/man-jp/search.html

ls  | xargs rm
ls *.* |xargs -i cp -a {} /hogepath
touch -t 200902010000 /work/oldstamp
touch -t 200902020000 /work/newstamp
find ./ -newer /work/oldstamp -and ! -newer /work/newstamp  -exec cp {} /work/test/{} \;
df -i

network

search hoge.domain
nameserver 192.168.1.1
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
TYPE=Ethernet
ifconfig eth0:0 192.168.100.190 netmask 255.255.255.0 broadcat 192.168.100.255
route add -host 192.168.1.1 dev eth0:0

ssh

ssh -i .ssh/ninsyou hogeuser@192.168.1.1
/lib/libc.so.6

wget

http://www.gnu.org/software/wget/wget.html

./configure
make
make install

service --status-all





http://www.7key.jp/computer/top.html
http://www.math.kobe-u.ac.jp/~kodama/tips-free-memory.html

cat /proc/cpuinfo
cat /proc/meminfo
/etc/rc.d/init.d/network restart 
hostname xxx.ffff.yyy

grep

grep kensakusitaimoji hoge.txt

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
id:3:initdefault:
l3:3:wait:/etc/rc.d/rc 3
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile



tcpdump

http://itpro.nikkeibp.co.jp/article/COLUMN/20070403/267311/

uname -a
# chkconfig: 345 80 15
chkconfig --level 345 httpd on
/sbin/service --status-all
hoge &
jobs
fg
yum install yum-utils
yumdownloader hoge;
rpm -ivh --force hoge.rpm 

RPM

http://rpm.pbone.net/

TAR

zip

unzip hoge.zip
zip hoge.zip hogefile
zip -r hoge.zip hogedir
zip -P password -e test.zip *.*
#    Option "XkbOptions" "ctrl:swapcaps"
boot: linux rescue

boot: linux single
boot: linux emergency

http://www.redhat.co.jp/manual/Doc80/RH-DOCS/rhl-cg-ja-8.0/s1-rescuemode-booting-single.html

boot -s


http://ftp.gnu.org/gnu/parted/

./configure
make; make install 

http://www.atmarkit.co.jp/flinux/rensai/linuxtips/461useparted.html
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/462partedsfd.html
http://nobumasa-web.hp.infoseek.co.jp/partition/parted/

rsync

rsync -avz --delete /home/test/ filesrv:/home/backup/










http://dar.linux.free.fr/

wget http://downloads.sourceforge.net/dar/dar-2.3.2.tar.gz?modtime=1162240068&big_mirror=0
tar xzvf dar-2.3.2.tar.gz
cd dar-2.3.2
./configure
make
/lib/libattr.a: No such file or directory

http://dar.linux.free.fr/doc/FAQ.html

ln -s /usr/lib/libattr.a /lib/libattr.a
make install-strip
Commands are:
 -c  creates an archive
 -x  extracts files from the archive
 -d  compares the archive with the existing filesystem
 -t  tests the archive integrity
 -l  lists the contents of the archive
 -C  isolates the catalogue from an archive
 -+  merge two archives / create a sub archive
dar -c /backup/homeall -g home
Parse error on command line (or included files): Cannot add an absolute path

homeall.1.dar
dar -c /backup/homeall-1 -g home  -A /backup/homeall
homeall-1.1.dar
dar -x /backup/homeall
dar -x /backup/homeall -g home/hoge.txt
cp -ar /var/lib/mysql/*** /home/backup
cp -ar /home/httpd/html /home/backup

dump

find /backup -mtime +1 -maxdepth 1 -name '*.zip' -exec rm -f {} \; 

/sbin/dump -0f - /dev/hda1 2>> /backup/backup.log | gzip > /backup/hda1_`date +%m%d`.zip

dump -0f /backup/backup /dev/hda1

zcat /backup/hda7_0307.zip | restore -tf - z
passwd
group
shadow

http://www-6.ibm.com/jp/developerworks/linux/040213/j_l-roadmap8.html
http://vision.featia.net/linux/rsync.jsp
http://www.double-h.com/linux/tipsmemo/others/general01.html
http://www.mediaweb.biz/database/cobalt_tips/cobalt_rsync.html
http://ito-web.dip.jp/server_conf/mondo_rescue.html

find . -type d
find . -name "*.php" -exec chmod 555 {} \;
cp -a /hoge /backup/hoge`date +%w`

http://www.a-yu.com/opt/fdisk.html
http://www.deer-n-horse.jp/linux/tips/extension_hdd.html

cron

01   *   *   *   *    root   run-parts       /etc/cron.hourly
02   4   *   *   *    root   run-parts       /etc/cron.daily
22   4   *   *   0    root   run-parts       /etc/cron.weekly
42   4   1   *   *    root   run-parts       /etc/cron.monthly





0-59/5 * * * * /test
0,10,20,30,40,50 * * * *
* 5 * * *

run-parts /etc/cron.hourly

http://www.express.nec.co.jp/linux/distributions/knowledge/system/crond.html

fstab

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2

fs_mntops







fs_freq


fs_passno



du -s dir
df -k
df -hT
mkdir -p hoge/hoge/hoge
free -s 1 -c 300
           total       used       free     shared    buffers     cached
Mem:       1018348    1002200      16148          0      91376     709944
-/+ buffers/cache:     200880     817468
Swap:      2031608        160    2031448
watch -n 1 -d free
vmstat 1 300

http://itpro.nikkeibp.co.jp/article/COLUMN/20060228/230989/

BitDefender

bdc --all --arc --delete --log=/var/log/bitdefendef.log /home
wget http://www01.tcp-ip.or.jp/~furukawa/nkf_utf8/nkf204.tar.gz
tar xzvf nkf204.tar.gz
cd nkf204
make
make test
mv nkf /usr/bin/
find . -name '*.*' | xargs nkf -e -Lu --overwrite










mount -t tmpfs -o size=10m tmpfs /dev/shm
mount -t tmpfs -o size=10m /dev/shm /hoge
ldconfig -p | grep hoge.so

/etc/sysconfig/i18n

LANG="ja_JP.UTF-8"
LANG="ja_JP.eucJP"

nmap

http://www.insecure.org/nmap/

wget http://download.insecure.org/nmap/dist/nmap-4.20.tgz
tar xzvf nmap-4.20.tgz
cd nmap-4.20
./configure
make 
make install
netstat -lutp
lsof -i:80,81

http://x68000.q-e-d.net/~68user/unix/pickup?netstat http://www.linux.or.jp/JM/html/net-tools/man8/netstat.8.html

netstat -ape
auth       required     pam_nologin.so

paco

wget http://downloads.sourceforge.net/paco/paco-2.0.6.tar.gz?modtime=1223591447&big_mirror=0
tar xzvf paco-2.0.6.tar.gz 
cd paco-2.0.6
./configure
checking for GTKMM... configure: error: The pkg-config script could not be found or is too old.  Make sure it

ftp://ftp.ring.gr.jp/pub/X/gnome/sources/gtkmm/2.4/

wget ftp://ftp.ring.gr.jp/pub/X/gnome/sources/gtkmm/2.4/gtkmm-2.4.8.tar.gz
tar xzvf gtkmm-2.4.8.tar.gz  
cd gtkmm-2.4.8
./configure
configure: error: Library requirements (glibmm-2.4 >= 2.4.0 atk >= 1.6.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.

ftp://ftp.ring.gr.jp/pub/X/gnome/sources/glibmm/2.4/

wget ftp://ftp.ring.gr.jp/pub/X/gnome/sources/glibmm/2.4/glibmm-2.4.8.tar.gz
tar xzvf glibmm-2.4.8.tar.gz 
cd glibmm-2.4.8
./configure
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full

path to pkg-config.

To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.

http://pkg-config.freedesktop.org/wiki/

wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
tar xzvf pkg-config-0.23.tar.gz 
cd pkg-config-0.23
./configure
make
make install
./configure
configure: error: Package requirements (sigc++-2.0 >= 2.0.0 glib-2.0 >= 2.4.0 gobject-2.0 >= 2.4.0 gmodule-2.0 >= 2.4.0) were not met.

ftp://ftp.ring.gr.jp/pub/X/gnome/sources/libsigc++/2.0/

wget ftp://ftp.ring.gr.jp/pub/X/gnome/sources/libsigc++/2.0/libsigc++-2.0.18.tar.gz
tar xzvf libsigc++-2.0.18.tar.gz 
cd libsigc++-2.0.18
./configure
make
make install



device (hd0) /dev/hdb
root (hd0,0)
install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf 
quit
device (hd0) /dev/sdb
root (hd0,0)
install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf
quit
more /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdb1[1] hda1[0]
 104320 blocks [2/2] [UU]

A Fail event had been detected on md device /dev/md3.
Personalities : [raid0] [raid1]
md0 : active raid0 hdb2[1] hda2[0]
     131539968 blocks 256k chunks
mdadm --query /dev/md3
/dev/md3: 48.83GiB raid1 2 devices, 0 spares. Use mdadm --detail for more detail.
/dev/md3: No md super block found, not an md component.
mdadm --detail /dev/md3
       Version : 00.90.01
 Creation Time : Tue Jul  5 01:43:51 2005
    Raid Level : raid1
    Array Size : 40957568 (39.06 GiB 41.94 GB)
   Device Size : 40957568 (39.06 GiB 41.94 GB)
  Raid Devices : 2
 Total Devices : 1
Preferred Minor : 2
   Persistence : Superblock is persistent

   Update Time : Wed Jul 25 11:53:11 2007
         State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
 Spare Devices : 0

          UUID : 804f4246:8ee45dfb:61f65e69:124a6043
        Events : 0.163354

   Number   Major   Minor   RaidDevice State
      0       0        0        -      removed
      1       3       69        1      active sync   /dev/hdb5

fdisk -l /dev/hda
fdisk /dev/hdb

fdisk -l /dev/hdb
mdadm --manage /dev/md0 --add /dev/hdb1
mdadm --manage /dev/md1 --add /dev/hdb2
more /proc/mdstat

SoftwareDesign






The Software-RAID HOWTO

mount

mount.cifs //192.168.1.10/test /mnt/test -o username=hoge,passwrd=hogepass
mount -t smbfs -O username=hoge,password=hogepass //192.168.1.10/test /mnt/test
cat /proc/filesystems

nfs

mount -t nfs 192.168.1.2:/ /mnt/hoge

http://www.linux.or.jp/JM/html/util-linux/man8/mount.8.html

hdparm /dev/hda
/dev/hda:
multcount    = 16 (on)
IO_support   =  0 (default 16-bit)
unmaskirq    =  0 (off)
using_dma    =  1 (on)
keepsettings =  0 (off)
readonly     =  0 (off)
readahead    = 256 (on)
geometry     = 19929/255/63, sectors = 163928604672, start = 0
hdparm -Tt /dev/hda
Timing cached reads:   2200 MB in  2.00 seconds = 1099.07 MB/sec
Timing buffered disk reads:  164 MB in  3.00 seconds =  54.64 MB/sec
hdparm -c3 /dev/hda

http://www.linux.or.jp/JM/html/hdparm/man8/hdparm.8.html

nohup hoge &
ldd
otool -L

http://perso.wanadoo.fr/sebastien.godard/

wget ftp://ibiblio.org/pub/linux/system/status/sysstat-6.0.1.tar.gz
tar xzvf sysstat-6.0.1.tar.gz
cd sysstat-6.0.1
make config
make
make install
yum install sysstat
iostat
sar 1 5

http://www.atmarkit.co.jp/flinux/rensai/root07/root07b.html

smartctl -t short /dev/hda
smartctl -l selftest /dev/hda
smartctl -a /dev/hda
194 Temperature_Celsius     0x0032   042   253   000    Old_age   Always       -       44

http://ja.wikipedia.org/wiki/Self-Monitoring,_Analysis_and_Reporting_Technology

Device: /dev/hda, 1 Currently unreadable (pending) sectors
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed: read failure       60%     17878         234152622
fdisk -lu /dev/hda
Disk /dev/hda: 163.9 GB, 163928604672 bytes
255 heads, 63 sectors/track, 19929 cylinders, total 320173056 sectors








Xlib: connection to "display:0.0" refused by server

Ctrl+r
(reverse-i-search)`':
stty -a
stop = ^S;
stty stop ^x 
(i-search)`':

etc

http://www.linuxworld.jp/etc/

cat /proc/cpuinfo

http://www-06.ibm.com/jp/developerworks/linux/030314/j_l-htl.html
http://www-06.ibm.com/jp/developerworks/linux/040227/j_l-web26.html

echo 30 > /proc/sys/kernel/panic

RIPlinux


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS