Monday, May 27, 2013

Linux Command

Linux Command

find

check linux system info:
# lsb_release -a

get the key in ubuntu:
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192

scan IP in the network
# arp-scan --interface=eth1 10.0.0.0/8
# arp-scan -I wlan1 10.0.0.0/8

List process user
# ps -o ruser,pid
List process with the pid
lsof -p pid

Command scp with key file copy file application.tar.gz to server001 and put in /home/user
sudo scp -i /home/vannak/server-key.pem application.tar.gz user@server001:/home/user

List Mount Device and Mount Informations:
lsblk

Download with Aria2c
aria2c -s 10 http://web-site.com/applications.tar.gz -d /where/to/store
or write down in a script:
#!/bin/bash
# download
    if (! test $1)
         then
              echo "Usage: $0 link-download"
         exit 1
    fi
aria2c -s10 $1 -d /where/to/store >/dev/null 2>&1 &


RSYNC
rsync from other server to keep in our computer
rsync -avz user@server001:/path/to/sync/file001.tar.gz /where/to/keep/
rsync from our computer to server
rsync -avz /what/we/to/sync/ user@server001:/path/to/keep/on/server

SSHPASS
sshpass -p 'sshpassword' scp -r user@server001:/part/of/folder/ /local/path/folder

How to Get Mail when the system restart by add this line in cronjob in the system (crontab -e)
@reboot  echo "Server has restarted "`hostname` | mail -s "System Restart" vannakk@gmail.com

No comments:

Post a Comment