Useful Unix Commands

Many people ask, where to start learning Linux.

Answer 1: Install Ubuntu on pen drive and boot your system. It wont disturb your existing OS. You can save files too on pen drive.

https://help.ubuntu.com/community/Installation/FromUSBStick

http://polimetla.com/2009/06/24/fulfilling-the-dream-of-having-my-own-unix-server-in-progress/

Answer 2: Search in google for free unix shells or free unix accounts. http://m-net.arbornet.org

Download Putty.exe and start accessing free unix accounts.

======== Basic Commands ========

Clear all screen
>clear

See all commands you typed before
>history

Shows date
>date

Calendar
>cal

Man means manual
>man cal

======== CHECK LOGS ========

Prints server.log file on console while app is running
>tail -f server.log

Shows last 100 lines
>tail -100 server.log

Shows first 100 lines
>head -100 server.log

Shows one page at a time
>more server.log

Use cat for small files. This prints whole file on console
>cat server.log

======== CHECK Processes ========

To see all running process
>ps -ef

To check specific process
>ps -ef | grep process name

======== Disk, CPU, Memory Usage ========
Check Disk Space
>df

Check CPU Usage

>top

Direcotry space in Unix
>du -sh dir1

To get CPU Details
>cat /proc/cpuinfo

uname will help us to find given os is 32 bit or 64 bit.

>uname -m
i386 / i686 ==> 32 bit
x86_64 ==> 64bit

To get OS information
cat /proc/version

To get CPU Usage
>ps -e -o pcpu,cpu,nice,state,cputime,args -sort pcpu | sed ‘/^ 0.0 /d’

http://www.pixelbeat.org/cmdline.html

Memory Information

>cat /proc/meminfo

To do profiling

>free -m

http://www.cyberciti.biz/faq/linux-system-memory-utilization/

======= VI Commands ===========
Please check any VI Commands cheat sheet

>vi file name

Takes to end of the file
>shift g

To quit
>esc :q!

To write
>esc :w!

======= Compress/Decompress Commands ===========

$tar -cvf file1.tar a.txt

$tar -xvf file1.tar

——————————

$gzip a.txt
Output: a.txt.gz

$gunzip a.txt.gz
Output: a.txt

——————————

How to change prompt to present working directory?

>export PS1=’$PWD>’

======================================
Search in google to get more command lists
======================================

Advertisements

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