You are on page 1of 6

8/3/13

Basic Linux Command Lines For Newbies!


Saturday, August 03, 2013

| Electronics | Solar | Consumer Electronics | Infotech | Linux & Open Source | Smartphones | Tablets | Science & Technology | Computex 2013

Search

Home >> Linux & Open Source >> Technology

Basic Linux Command Lines For Newbies!


If you are new to the world of Linux, this article is a must-read for you. These Linux command lines can make your life easier.
Rate this news: (0 Votes)

Saturday, August 03, 2013: If you are a starter in Linux, you might find it a little difficult to understand which command line to use for which function. So here we bring to you command line examples of some much used commands, which will be good enough to give you a kickstart in Linux!

Need Linux Training?


It's easy with video lessons & PDFs 130 Available Lessons And A Server linuxacademy.com

1. tar command examples Create a new tar archive.


$t a rc v fa r c h i v e _ n a m e . t a rd i r n a m e /

Extract from an existing tar archive.


$t a rx v fa r c h i v e _ n a m e . t a r

View an existing tar archive.


$t a rt v fa r c h i v e _ n a m e . t a r

SUBSCRIBE TO EFYTIMES
Receive the latest reviews, how-tos, news

2. grep command examples Search for a given string in a file (case in-sensitive search).

Enter your email address:

Subscribe
$g r e pi" t h e "d e m o _ f i l e Delivered by FeedBurner

Print the matched line, along with the 3 lines after it.
$g r e pA3i" e x a m p l e "d e m o _ t e x t

Search for a given string in all files recursively


$g r e pr" a t i t h y a "*

Book Your Air Ticket


Round Trip Leaving From:
---------------

One Way Going To:


---------------

Depart Date:

Return Date:
3

3. find command examples Find files using file-name ( case in-sensitve find)

Aug 2013

www.efytimes.com/e1/fullnews.asp?edid=112641

1/6

8/3/13
#f i n di n a m e" M y C P r o g r a m . c "

Basic Linux Command Lines For Newbies!

Most popular
Execute commands on files found by the find command
$f i n di n a m e" M y C P r o g r a m . c "e x e cm d 5 s u m{ }\ ;
Daily Weekly

Top 10 IT Certifications For 2013

Find all empty files in home directory


#f i n d~e m p t y

Basic Linux Command Lines For Newb Five Top Linux Tips And Tricks! Top 5 Android Smartphones To Buy In August 2013

4. ssh command examples Login to remote host


s s hlj s m i t hr e m o t e h o s t . e x a m p l e . c o m

Narendra Modi Smartphone Smart NaM New Specs, Pictures Revealed!

Debug ssh client


s s hvlj s m i t hr e m o t e h o s t . e x a m p l e . c o m

Display ssh client version


$s s hV O p e n S S H _ 3 . 9 p 1 ,O p e n S S L0 . 9 . 7 aF e b1 92 0 0 3

5. sed command examples When you copy a DOS file to Unix, you could find \r\n in the end of each line. This example converts the DOS file format to Unix file format using sed command.
$ s e d' s / . $ / / 'f i l e n a m e

Print file content in reverse order


$s e dn' 1 ! G ; h ; $ p 't h e g e e k s t u f f . t x t

Features

Top 8 Must-Read Books For Professional Growth We are presenting here some must-read titles that will help you enhance your knowledge and lead to professional growth.... Top Linux Distros Of 2013 Here are the top Linux distributions for this yea Just explore which one works best for you......

Add line number for all non-empty-lines in a file


$s e d' / . / = 't h e g e e k s t u f f . t x t|s e d' N ;s / \ n // '

6. awk command examples Remove duplicate lines using awk


$a w k' ! ( $ 0i na r r a y ){a r r a y [ $ 0 ] ;p r i n t} 't e m p

Videos
First Look: LG Optimus G The phone sports a high-end display and comes powered by a powerful processor. ...

Print all lines from /etc/passwd that has the same uid and gid
$ a w kF' : '' $ 3 = = $ 4 'p a s s w d . t x t

Print only specific field from a file.


$a w k' { p r i n t$ 2 , $ 5 ; } 'e m p l o y e e . t x t

Create QR-Codes For Free TEC-IT releases the freeware QR-Code Studio to provide a quick and convenient way of QR code creation for every application scenario....

Dialogue
7. Sort command examples Sort a file in ascending order
$s o r tn a m e s . t x t IBM Will Continue To Invest In Open Source Technology Projects Diksha P Gupta from EFYTimes.com spoke to Dipankar Sarma, distinguished engineer, Systems & Technology Labs, IBM India, to discus... "OpenStack Is A Very Ambitious Project And Has A Lot Of Usability"

Sort a file in descending order

www.efytimes.com/e1/fullnews.asp?edid=112641

2/6

8/3/13
$s o r trn a m e s . t x t

Basic Linux Command Lines For Newbies!

Project And Has A Lot Of Usability" Diksha P Gupta from EFYTimes spoke to Jonathan Bryce, executive director of the OpenStack Foundation, about the project, its late...

Sort passwd file by 3rd field.


$s o r tt :k3 n/ e t c / p a s s w d|m o r e

Computex 2013
Computex 2013 Round-up: Top Android Products Major brands introduced their tablets, smartphones, phablets and other future announcements. ... Lenovo Shows Off 'Miix 8'; An 8-Inch Tablet Lenovo and Microsoft flashes 8 inch tablet Mixx 8 at Computex 2013! Keeps mum over major features....

8. export command examples To view oracle related environment variables.


$e x p o r t|g r e pO R A C L E d e c l a r exO R A C L E _ B A S E = " / u 0 1 / a p p / o r a c l e " d e c l a r exO R A C L E _ H O M E = " / u 0 1 / a p p / o r a c l e / p r o d u c t / 1 0 . 2 . 0 " d e c l a r exO R A C L E _ S I D = " m e d " d e c l a r exO R A C L E _ T E R M = " x t e r m "

To export an environment variable:


$e x p o r tO R A C L E _ H O M E = / u 0 1 / a p p / o r a c l e / p r o d u c t / 1 0 . 2 . 0

EFY India
Like 7,375 people like EFY India.

9. xargs command examples Copy all images to external hard-drive


#l s* . j p g|x a r g sn 1ic p{ }/ e x t e r n a l h a r d d r i v e / d i r e c t o r y

Search all jpg images in the system and archive it.


#f i n d/n a m e* . j p gt y p efp r i n t|x a r g st a rc v z fi m a g e s . t a r . g z

F acebook social plugin

Download all the URLs mentioned in the url-list.txt file


#c a tu r l l i s t . t x t|x a r g sw g e t c

10. ls command examples Display filesize in human readable format (e.g. KB, MB etc.,)
$l sl h r w r -1a t i t h y at e a m d e v8 . 9 MJ u n1 21 5 : 2 7a r c h l i n u x . t x t . g z

Order Files Based on Last Modified Time (In Reverse Order) Using ls -ltr
$l sl t r

Comments
on Here Are Top 8 Chrome Extensions

Jay said: "TABS OUTLINER -Brilliant Exte

Visual Classification of Files With Special Characters Using ls -F


$l sF

mohammed said: "it is utter waste dont Review: BSNL Penta T-Pad IS701C ...

Events
11. pwd command pwd is Print working directory. What else can be said about the good old pwd who has been printing the current directory name for ages. 12. cd command examples Use cd - to toggle between the last two directories Use shopt -s cdspell to automatically correct mistyped directory names on cd 13. gzip command examples To create a *.gz compressed file:
$g z i pt e s t . t x t 12 Nov: LASER World Of PHOTONICS INDIA

www.efytimes.com/e1/fullnews.asp?edid=112641

3/6

8/3/13

Basic Linux Command Lines For Newbies!

To uncompress a *.gz file: $ gzip -d test.txt.gz

Display compression ratio of the compressed file using gzip -l


$g z i pl* . g z c o m p r e s s e d 2 3 7 0 9

u n c o m p r e s s e d r a t i ou n c o m p r e s s e d _ n a m e 9 7 9 7 5 7 5 . 8 %a s p p a t c h r p m s . t x t

14. bzip2 command examples To create a *.bz2 compressed file:


$b z i p 2t e s t . t x t

To uncompress a *.bz2 file:


b z i p 2dt e s t . t x t . b z 2

15. unzip command examples To extract a *.zip compressed file:


$u n z i pt e s t . z i p

View the contents of *.zip file (Without unzipping it):


$u n z i plj a s p e r . z i p A r c h i v e : j a s p e r . z i p L e n g t h D a t e T i m e - 4 0 9 9 5 1 1 3 0 9 82 3 : 5 0 3 2 1 6 9 0 8 2 5 9 82 1 : 0 7 1 5 9 6 4 0 8 2 5 9 82 1 : 0 7 1 0 5 4 2 0 8 2 5 9 82 1 : 0 7

N a m e M E T A I N F / M A N I F E S T . M F c l a s s e s _ c l a s s e s _ n a m e s c l a s s e s _ n c o m p

16. shutdown command examples Shutdown the system and turn the power off immediately.
#s h u t d o w nhn o w

Shutdown the system after 10 minutes.


#s h u t d o w nh+ 1 0

Reboot the system using shutdown command.


#s h u t d o w nrn o w

Force the filesystem check during reboot.


#s h u t d o w nF rn o w

16. ftp command examples Both ftp and secure ftp (sftp) has similar commands. To connect to a remote server and download multiple files, do the following.
$f t pI P / h o s t n a m e f t p >m g e t* . h t m l

To view the file names located on the remote server before downloading, mls ftp command as shown below.

www.efytimes.com/e1/fullnews.asp?edid=112641

4/6

8/3/13

To view the file names located on the remote server before downloading, mls ftp command as shown below.
f t p >m l s* . h t m l/ f t p t e s t / f e a t u r e s . h t m l / f t p t e s t / i n d e x . h t m l / f t p t e s t / o t h e r t o o l s . h t m l / f t p t e s t / s a m p l e r e p o r t . h t m l / f t p t e s t / u s a g e . h t m l

Basic Linux Command Lines For Newbies!

17. ps command examples ps command is used to display information about the processes that are running in the system. While there are lot of arguments that could be passed to a ps command, following are some of the common ones. To view current running processes.
$p se f|m o r e

To view current running processes in a tree structure. H option stands for process hierarchy.
$p se f H|m o r e

Print

Email

Post Comment

(Total Views: 1260)

142
Share

6
Tw eet

StumbleUpon Submit

Linux & Open Source News


Top Linux Distros Of 2013 Android Jelly Bean Now Running On 40 Per Cent Devices! Basic Linux Command Lines For Newbies! Now, Read Free Open Source Textbooks Courtesy OpenStax Here's PiCast, The Open Source Alternative To Google Chromecast

Press Release
Sachin Tendulkar Unveiled The All-New ... SOLARCON India 2013 Begins With ... HealthKart Launches First Of Its Kind ... Michael Dell And Silver Lake Agree With ... Rakuten Reports Consolidated Financial ... Murata To Acquire Crystal Device ... InvenSense Announces New Offices ... ManageEngine Announces Winners Of ...

www.efytimes.com/e1/fullnews.asp?edid=112641

5/6

8/3/13
Department Of Justice Proposes Remedy ...

Basic Linux Command Lines For Newbies!


SITA Signs 10-Year Agreement With Biman ...

Time Warner Cable Suspends Showitme ... Tenneco Opens State-Of-The-Art, Fully ... SATA III Now Available For Aerospace ... Canon Expands Service Network In India Adaptxt Celebrates Friendship Day: ... TAKE Solutions Announces Its Q1FY14 ... Eagle Datagistics Achieves Oracle ... The CRM Alliance To Hold ACT! CRM And ... Enhanced Vision Introduces The New ... Microsoft Validated Control Panel For ... AlphaDigits Top Rated Apps July 2013 New Revenue Assurance Managers Advanced ... Dataline Launches Web Based Solution ... EarthBend Announces Its Acquisition Of ... State Bank Of India Wins IDRBT Banking ... RationalPlan 4.5 Improved Reporting ... LED Oversupply Likely To Continue As ... Parental Control Software And Filtering ... Angels Wrath Announces Version 4.5 Toshiba Selected By Japan's NIRS To ...

Price Crash Campaign Across All Easyday ... Land Rover's Innovative Electric ... Renesas Electronics Announces Forecasts ... Hunted Cow Releases Eldevin Founder ... Tech Mahindra Announces Pioneering ... FCI's BERGSTAK 0.8mm Connectors ... Acer Aspire E1-522 AMD Notebook ... Renesas Electronics Shows Direction Of ... Netflix Becomes Even More Personal With ... Kindle Worlds Expands-Amazon Publishing ... SMS AudioTM Launches STREET By 50TM ... Strategy Analytics: Android Captures ... Sol Republic And Motorola Make Music ... Moto X Responds To Your Voice, With No ... AT&T Is Making It Easier And More ... OmniVision Launches Native 16:9 ... AT&T Ranks Highest In Wireless Customer ... FireEye Introduces 'Fuel' Partner ... Idea Cellular Announces Un-Audited ... GM And Honda To Collaborate On ...

home

archives

contact us

advertise with us

Magazines
Electronics for You Open Source for You Facts for You Electronics Bazaar

Portals
electronicsforu.com efytimes.com bpotimes.com linuxforu.com

Directories
Electronics Annual Guide

Events
EFY EXPO EFY Aw ards EduTech Expo OSIWEEK Expo

News Verticals
Electronics Infotech Linux & Open Source Consumer Electronics Science & Technology BPO

Educational Institute
EFY Techcenter

Copyright 2013 EFY Enterprises Pvt. Ltd. All rights reserved. Reproduction in whole or in part in any form or medium without written permission is prohibited. Usage of the content from the web site is subject to Terms and Conditions

www.efytimes.com/e1/fullnews.asp?edid=112641

6/6

You might also like