Tuesday, November 17, 2009

 

SSH restart

How to I restart sshd

After you have changed your configuration on your remote Unix/linux server you must restart your ssh service.

The easiest way to do this is to simply restart your Unix machine. This is not always possible however.

To restart sshd without restarting your whole system, enter the following command

RedHat and Fedora Core Linux
service sshd restart

Suse linux
/etc/rc.d/sshd restart

Solaris 9 and below
/etc/init.d/sshd stop
/etc/init.d/sshd start

Solaris 10
svcadm disable ssh
svcadm enable ssh

AIX
stopsrc -s sshd
startsrc -s sshd

Labels: ,


Thursday, November 12, 2009

 

Perl/AWK/SED One-Liners

- list all the files but cut the last part "_public_access.log_stats.html"

- Prints part of the command output, wc -l would print ($1, $2) if you want both to be printed use awk '{print $1,$2}' - Reference

- Print lines after 11 in a file - Reference

- Print lines in a range , if you specify the end as 0 (zero) it will print all the lines starting from the begin range provided till the end of the file

- delete all find under all sub folders in a folder at once in one line. The cool thing here is piping to sh, which is same as piping it to a sh file and running it, all in one line

- list all files with the matching regular expression but only the part of the file name you need dont repeat if its already printed. ( sort is a unix command and uniq is also a unix command )

- this cmd will list all lines which are identical in 2 files. This is different than diff in the sense that it is not location sensitive, hence very useful for listing common contents/lines in files regardless of location.

- this one-line cmd will add suffix specified "SUFFIX_TXT" at the end of each line in the original_file.txt and pipe it to a new file

- This one-line cmd will go through all the XML files in a folder ( in this case 270, and apply the regular expression to all of them.

- This online command will do jar -tvf on all jars on all jars in the folders and the sub-folders, you can also do with with awk, but awk cant do sub-folder as we use grep there

  • find . -name "*.txt" | awk '{print "echo '"'test '"' >> " $1}' | sh
- This cmd will find all the files that match the regex recursively and append the text "test" to them
reference -

http://www.catonmat.net/blog/wp-content/uploads/2008/09/awk1line.txt

Labels: , , ,


This page is powered by Blogger. Isn't yours?