From windows machine you connect to linux PC using telnet or ssh via putty.
You must login using your credentials.
Create Directory:
mkdir <dir name>
Change Directory Path
cd <dir name>
Create a File
Reach the particular directory under which you want to create a file and then issue this command
vi <file name>
While coming our of the file isuue :wq to save the changes and come out
Issue :q! to come out without saving the changes
Delete File
rm <file name>
Delete Directory
rmdir <dir name>
Note that there should be no files under the directory for it to be deleted using this command
List
ls -lrt
Search
To search for a pattern of a file name, issue this command under the required directory
ls *<pattern>*
To search for a file containing a particular content pattern issue this command under the required directory
grep <pattern> *
To search for a file containing a pattern recursively from a directory (if you dont know in which directory the file would be present
find . | xargs grep "pattern"
Other useful linux commands:-
~~~~~~~~~~~~~~~~~~~~~~
To kill a process:-
ps -ef | grep <process name>
process id will be displayed.
Then kill the process using the command
kill <pid>
We can also kill the process in a single line:-
pkill <processName>
To Enable different services for different protocols
~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. FTP - vsftpd
service vsftpd start
2. TELNET - xinetd
service xinetd start
3. SMTP - send mail
4. HTTP - httpd
service httpd start
5. RADIUS - radiusd
service radiusd start
6. DNS - named
service named start
7. IMAP4 - xinetd
service xinetd start
8. MMS -
9. LDAP - ldap
service ldap start
10. RTSP
Ports and Port Numbers
~~~~~~~~~~~~~~~~~~~~
1. FTP - 21
2. TELNET - 23
3. SMTP - 25
4. HTTP - 80
5. RADIUS - 1812
6. DNS - 53
7. IMAP4 - 143
8. MMS - 1755
9. LDAP - 389
10. RTSP - 554
Command to send fragmented icmp traffic
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ping 172.26.64.213 -c 3 -s 2000
-c - count
-s - size
Command to drop SYN packets in the lnux PC using ip tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
iptables -A INPUT --protocol tcp --tcp-flags ALL SYN -j DROP
To flush the iptables
~~~~~~~~~~~~~~
iptables -F
Command to test with tethereal
tethereal -i eth1 tcp &
Command to unconfigure or flush an Ethernet interface ip in linux
ip addr flush eth1
ip addr del eth1 <ip>