Sunday, July 31, 2011

SVN [git svn] basic commands

git svn clone <source address> - initial copy to work directory
git svn fetch && git svn rebase - further updates
git checkout -f - restore everything
git diff - check changes


Saturday, July 30, 2011

Basic commands

Commands to work with files and directories:
ls – print list of files and directories
ls -la – print list of files and directories (with hidden)
cd – change current directory
pwd – print current directory
mkdir dir – make a directory named "dir"
rm file –remove file
rm -r dir – remove directory dir
rm -f file – force remove file
rm -rf dir – удалить форсированно каталог dir
cp file1 file2 – copy
cp -r dir1 dir2 – copy dir1 into dir2; if there is no dir2, it will be created
mv file1 file2 – raname or move file1 to file2.
ln -s file link – create a simlink
touch file – create file
cat > file – output to file
less file – printout file
head file – print first 10 lines of file
tail file – print last 10 lines of file
tail -f file – print content of file 

ps – print current active processes
ps aux - print all procesess
ps aux | grep -v grep | grep -i %name - find process %name (you can use part of name)
top – show all running processes
kill pid – kill process by id pid
killall proc – kill all processes named proc
bg – list of stopped tasks and task in background;
fg
fg n
Permission:  
chmod octal file – change permission file to octal,separately for user, group and for all by adding:
4 – read (r)
2 – write (w)
1 – execute (x)
SSH
ssh user@host connect to host as user
ssh -p port user@host connect to host as user by port
ssh-copy-id user@host add your key to host for user to turn on login without password
ethtool - is a command that allows to display or modify a NIC's parameters

scp - is a command to copy files and directories securely between remote hosts (example: scp filename username@hostname:/home/)
uuidgen - command line utility to generate a new UUID value
passwd
- change user password


grep -r 'word_to_find' [path] - find recursively (example: grep -r 'dhcp' /etc*/*)   

Useful tools

wireshark - is a network protocol analyzer for Unix and Windows
tshark is a console version of wireshark
iperf - traffic generator is a commonly used network testing tool that can create  tcp and udp data streams and measure the throughput of a network that is carrying them
packEth -  is a Linux GUI packet generator tool for ethernet. It allows you to create and send any possible packet or sequence of packets on the ethernet
tcpdump - dump traffic on a network
tcpreplay - gives you the ability to use previously captured traffic in Libcap format to test a variety of network devices. It allows you to classify traffic as client or server, rewrite Layer 2, 3 and 4 headers and finally replay the traffic back onto the network and through other devices such as switches, routers, firewalls, NIDS and IPS's. Tcpreplay supports both single and dual NIC modes for testing both sniffing and inline devices.
vlc -  is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVD, Audio CD, VCD, and various streaming protocols
mplayer - is a  movie player for Linux. Supports reading from network, dvd, vcd, file, pipes, and v4l.
Packet builder -  enables creating custom network packets; users can use this tool to check their network protection against attacks and intruders.Colasoft Packet Builder includes a very powerful editing feature. Besides common HEX editing raw data, it features a Decoding Editor allowing users to edit specific protocol field values much easier
PuTTY - SSH and telnet client
nmap - is a free and open source utility for network exploration or security auditing.
xchm - .chm viewer