Monday, June 11, 2012

How to disable Auto Login in OpenSuse 12.1




By default in OpenSuse 12.1 you are automatically logged in even if you have a password on your account. To disable this follow the simple steps below.




Start > Applications > System > Administrator Settings (YaST)


Click on Security and Users down the left hand side then click User and Group Management


In the bottom right hand corner click the drop down that says "Expert Options" and then Login Settings another box will then appear where you can untick "Auto Login" then Click OK.

Sunday, June 10, 2012

Install OpenSSH on CentOS 6


OpenSSH Installations under CentOS Linux


To install the server and client type:
# yum -y install openssh-server openssh-clients


Start the service:
# chkconfig sshd on
# service sshd start


Make sure port 22 is opened:
# netstat -tulpn | grep :22

Some useful commands and compression utilities on Debian 5


seq 500 > 500.txt


gzip -c 500.txt > 500.txt.gz 


to read this binary zip format(gz files)


zcat 500.txt.gz


to read the output per page basis


zcat 500.txt.gz | less


gzip -l option give the content and stat of the file


example gzip -l 600.txt.gz


similar utility Bzip2


bzip2 -c 600.txt > 600.txt.bz2 


bunzip2 600.txt.bz2


bunzip2 -f 600.txt.bz2(this will overrite the file 600.txt(if present in the 


current directory))


bzcat filename.bz2 will show us the content


for example


bzcat filename.bz2 > content.txt




using zip utility in debian 5.


zip a.txt.zip a.txt


(first the destination and then the source file name)


zip alltxt.zip *txt will zip all the txt files in the curre


unzip a.txt.zip 


unzip -l a.txt.zip to list the contents of the zip file


zcat will also show the content of the zip file


zcat alltxt.zip


unzip -l will show you file by file and zcat will show the contents of the 


file in the zip archive,but zcat will only show the content of the first file 


in the zip archive


so basically zcat works on both zip and gzip




tar utility make a tar archive of files


tar -cvf alltxt.tar *.txt


will create an archive full of all the txt files in the current directory


tar -xvf alltxt.tar will extract those files


tar -tvf alltxt.tar will show the contentof the tar file


du -ch shows the size acclaimed by the all the files in the current directory


to extract a particular file from the tar archive


tar -xvf alltxttar.tar 20.txt


to extract 2 particular file 


tar -xvf alltxttar.tar 20.txt 100.txt




(20.txt is one of the file the alltxt.tar archive)




creating a tar.gz archive


tar -czvf text.tar.gz *.txt


will create an archive named text.tar.gz containing all the text files


the argument has to be czvf,any other combination such as cvzf or cvfz won't 


work




when extracting the z option should be added like 


tar -xvf text.tar.gz


tar -xzvf text.tar.gz




creating tar.bz2 archive named newtest.tar.bz2 containing 


60.txt,70.txt,180.txt


tar -cjvf newtext.tar.bz2 60* 70* 180*




to extract an tar.bz2 archive 


tar -xvf newtext.tar.bz2


tar -xjvf newtext.tar.bz2


to see the content of an tar.bz2 archive


tar -tvf newtext.tar.bz2



Wednesday, June 6, 2012

Some useful commands in Debian 5/6


head and tail shows the first 10 and the last 10 lines of a file respectively


head -n 1 will show the first line and tail -n 1 will show the last line


STDERR 2>error.txt


ls -l sourav 2>> error.txt


will put the error in the file error txt


we can watch the ongoing errors in a different terminal using the command 


watch tail error.txt


file filename returns the type of the file


for example file * shows every file's type that is presented in the directory


wc -l filename shows the number of lines in a file


wc is for word count


seq 50 will show the sequence from 1 to 50


creating a loop in the terminal to print hello couple of times.




for i in `seq 50`;do echo "Hello"; done


or may be like this


for i in `seq 50`;do echo "Hello - $i"; done


suppose we want to see the number of files in a directory using a loop


for i in `ls -a`;do echo "File - $i"; done | wc -l




or may be see the files one by one using a loop


for i in `ls -a`;do echo "File - $i"; done 


reset to create a new buffer(any command will now run on a new buffer after the command reset)




free to see the info about memory


free -m returns the output in a more readable format


kill a process using top


type top


type k


enter the pid of the process

Sunday, June 3, 2012

Use ! to invoke previous command

The output of the history command will be

1.cd ~

2.pwd


etc etc.


to invoke a previously typed command without typing the full command just type

!2



pwd command will be executed