ubuntu

Linux

Tar & UnTar

untar .gz file

tar xzvf tarname.tar.gz

untar .tar file

tar -xvf filename.tar

tar a folder and sub folders

tar -cvvf foo.tar foo/

Finding files

sudo find / -name ‘filename’ -type d

Service Running on Particular Port

  • cat /etc/services | grep 60000

Searching in Files

  • grep “text string to search” directory-path
  • For recursively
grep -r “redeem reward” /home/tom

chown

sudo chown -R  vclub:users vclubcms/

chmod

sudo chmod -R 750 locale/

List of packages

dpkg –get-selections | grep curl

http://www.howtogeek.com/howto/linux/show-the-list-of-installed-packages-on-ubuntu-or-debian/

ubuntu ram size check

grep MemTotal /proc/meminfo

http://www.cyberciti.biz/faq/check-ram-in-ubuntu/

Installing LAMP

$tasksel

Select LAMP Server , click OK

Installing PHPMYadmin

update the apt repositiory by apt-get update

$apt-get install phpmyadmin

Install webmin

    1. sudo emacs /etc/apt/sources.list
    2. Add the following lines
    3. deb http://download.webmin.com/download/repository sarge contrib
      deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
    4. Save and exit the file
    5. Now you need to import GPG key
    6. wget http://www.webmin.com/jcameron-key.asc
    7. sudo apt-key add jcameron-key.asc
    8. Update the source list : sudo apt-get update
    9. Install webmin
    10. sudo apt-get install webmin
    11. Now you need to access webmin using https://serverip:10000/
  1. Login by root password.
  2. Create new user
  3. change the shell to /bin/bash for new user and www-data
  4. for new user secondary group to sudo
  5. By following this process when tried to login by newuser by putty gives following error
    1. Network error: Connection refused
    2. reboot the system.

ls command

display page by page

ls -l | more
ls -t | more
ls -t output_PaymentRQ_* | more

can use less by that we can move up and down .
we can use less and more without pipe.
ls –help
http://www.unix.com/unix-dummies-questions-answers/11163-display-result-one-page-time.html

creating sym link

ln -s /media/ExternDrive moreFilesLink

http://www.herikstad.net/2009/07/creating-symlink-in-ubuntu.html

Running password with sudo

echo “password” | sudo -S command_to_run
e.g.
echo “password” | sudo -S python manage.py compilemessages

escape shell special characters in a string

$ var=’; echo gotcha!’
$ eval echo hi $var

http://manpages.ubuntu.com/manpages/natty/man1/escape.1.html

rename file name

rename ‘s/^view//’ .py

Shell Scripting

#!/bin/bash
mydir=$(dirname $0)
export PYTHONPATH=$mydir
export DJANGO_SETTINGS_MODULE=vclubcms.settings
cd $mydir
echo ‘done’ >> $mydir/output.txt | echo “bij897jib” | sudo -S python $mydir/manage.py compilemessages –settings=vclubcms.settings
echo “password” | sudo -S touch $mydir/apache/django.wsgi
cd /var/www

Aliases

http://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html

Advertisements

About rahul23134654

Hi, I am Rahul Meha , B.E. in (I.T.)
This entry was posted in Ubuntu/Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s