Tuesday, April 24, 2012

Some command line ubuntu

MAP DIR IN UBUNTU
sshfs#$USER@far:/projects /home/$USER/far_projects fuse defaults,idmap=user 0 0
$ sshfs  matt@my.randombox.com:  randombox_home
sshfs tien.nguyen@server: /server

sshfs tien.nguyen@server:/home/staff/tien.nguyen /server


CHANGE LOCAL WHEN USE SFTP
lcd /home/tien.nguyen/software


See ip of LAN in company in ubuntu
vi /etc/dnsasq.d/dhcp.conf

Show process in ubuntu
ps aux | grep programname


Add new User in ubuntu
useradd -d /home/kevin -s /bin/bash -m kevin



Add user to group
useradd -G {group-nameusername


Show all user in group
grep developers /etc/group

See list folders
du -h | grep "G.*\./"

Run log mysql 

/mnt/mirror/backup/logs/mysql

Size and Free of HD
df
df -h //format with G
df -h | grep /dev/hda1 | cut -c 41-43 //show only for hda1
'du' - Finding the size of a directory
du /home/david   //size of david
du -h
du -ah
du -c
du -ch | grep total
du -s


SHOW TOTAL FILES IN UBUNTU
ls -l /backup/database/ | grep ^mytable_live-2012 | wc -l

SHOW NUMBER FILE IN UBUNTU
find . -type f | wc -l


FIND COMMAND LINE

find $HOME -name 'mysong.ogg' 
find $HOME -iname '*.ogg' 
sudo find / -iname '*.ogg' 
find $HOME -iname '*.ogg' -size +100M 
find $HOME -iname '*.ogg' -type f -size -100M 
find $HOME -atime +30
find $HOME -iname '*.ogg' -atime +30
find $HOME -iname '*.ogg' -size +20M 
find $HOME -iname '*.ogg' ! -size +20M 
find $HOME -iname '*.ogg' -o -iname '*.mp3'
find $HOME -name '*.ogg' -type f -exec du -h '{}' \;
ind /tmp -iname '*.mp3' -print0 | xargs -0 rm











No comments:

Post a Comment