basic linux commands | linux file system basic commands | study guide | rhce | linux

5

Click here to load reader

Upload: ahmad-ali

Post on 13-Aug-2015

50 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Basic Linux Commands | Linux File System Basic Commands | Study Guide | RHCE | Linux

Search...

You are here: Home // LINUX // RHCE 5 // Study Guide // Linux file system Basic commandsA A A

HOME COMPTIA WINDOW LINUX CISCO

TIPS AND TRICKS CAREERS

Basic Linux commands

In this article we would discuss some basic linux commands. Thesecommands require to perform normal tasks. Make familiar yourselfwith these commands. In our previous article we have create anormal user now login from that user.

In bracket right most side is showing user name Vinita and beside@Server is the hostname of computer and further ~ sign isshowing that user is presently logged in her home directory. Butfirst, every Linux user has a home directory. You can use the tilde(~) to represent the home directory of any currently active user. Forexample, if your username is Vinita, your home directory is/home/Vinita. If you have logged in as the root user, your homedirectory is /root. Thus, the effect of the cd ~ command depends onyour username. For example, if you have logged in as user Vickey,the cd ~ command brings you to the /home/Vickey directory. If youhave logged in as the root user, this command brings you to the/root directory. You can list the contents of your home directory fromanywhere in the directory tree with the ls ~ command. After bracketyou can see the command prompt of normal user is $ sign.

Basic Linux commands | Linux file system Basic commands |... http://computernetworkingnotes.com/linux-file-system-basic...

1 of 5 3/24/13 9:55 AM

Page 2: Basic Linux Commands | Linux File System Basic Commands | Study Guide | RHCE | Linux

OUR LATEST ARTICLES

Initial Configuration Tasks

How to change server 2008 computername

Localize time zone

How to assign a static ip address toserver 2008

Windows Server 2008 Editions

POPULAR ARTICLES

Sample Resume Objectives Resumeskills Resume career objectiveNetwork administrator resumeobjective

How to windows xp bootable cd stepby step guide

Basic Switch configurationscommands

How to install xp from pen drive usbdrive step by step guide

Collection of all Interview Questionsand Answers

No part of this site can be duplicated in any form without written permission from the WebmasterCopyright © 2010 - 2013 www.ComputerNetworkingNotes.com.

Terms and conditionsPrivacy PolicyContact Us

Free ComptiaStudy Guide

Free WorkgroupNetworking StudyGuide

Free MCSEStudy Guide

Free MCITPStudy Guide

Free CCNA 640 -802 Study Guide

Free RHCE 5Study Guide

Free RHCE 6Study Guide

$mkdir [ directory name ]mkdir command is used to create new directory. Let’s create aexample directory.

$mkdir example $ls example

now create a file. Syntax for creating file is

$cat > [file name]

This command can be used in three wayTo see the contents of fileTo create a new fileTo append the contents of file.

$cat [file name]

------------------------ To see the

contents of file

$cat > [file name]----------------------

To create a file

$cat >> [file name ]--------------------

To append the contents of file

Be little bit careful while using cat > command to create new file. Ifyou accidently used this command with existing file it will overwritethe contents of file. Use CTRL+D to save the contents of file.Different use of cat command

$cat > test This is test of file

$cat test This is test of file

$cat >> test This is second line

$cat example This is test of file This

is second line in test file

$cat > test Now file will over write

$cat test Now file will overwrite

Cisco Async NM-32A Modulewww.uns-inc.com/cisco-nm-32a

Used $800, Like new + Ship Today 45 Day Return - 1 Year Warranty

Basic Linux commands | Linux file system Basic commands |... http://computernetworkingnotes.com/linux-file-system-basic...

2 of 5 3/24/13 9:55 AM

Page 3: Basic Linux Commands | Linux File System Basic Commands | Study Guide | RHCE | Linux

$cd [ destination directory path]It is easy to change directories in Linux. Just use cd and name theabsolute path of the desired directory. If you use the relative path,just remember that your final destination depends on the presentworking directory.

as you can see in the output of ls command file is in white color anddirectory is in blue color.

There are two path concepts associated with Linux directories:absolute paths and relative paths.An absolute path describes the complete directory structure basedon the top level directory, root (/).A relative path is based on the current directory. Relative paths donot include the slash in front.The difference between an absolute path and a relative one isimportant To know more about path and directory structure

pwdIn many configurations, you may not know where you are relative to

Vi & Vim Video Tutorialwww.DecisionScienceNews.com

Learn Free by Just Watching! Designed for Absolute Beginners

Basic Linux commands | Linux file system Basic commands |... http://computernetworkingnotes.com/linux-file-system-basic...

3 of 5 3/24/13 9:55 AM

Page 4: Basic Linux Commands | Linux File System Basic Commands | Study Guide | RHCE | Linux

the root (/) directory. The pwd command, which is short for printworking directory, can tell you, relative to root (/). Once you knowwhere you are, you can determine whether you need to move to adifferent directory.

$cd ..this command is used to exit from current directory.

cpThe cp (copy) command allows you to take the contents of one fileand place a copy with the same or different name in the directory ofyour choice. For example, the cp file1 file2 command takes thecontents of file1 and saves the contents in file2. One of the dangersof cp is that it can easily overwrite files in different directories,without prompting you to make sure that's what you really wanted todo.

mvYou can't rename a file in Linux, you can move it. The mv commandessentially puts a different label on a file. For example, the mv file1file2 command changes the name of file1 to file2. Unless you'removing the file to a different partition, everything about the file,including the inode number, remains the same.

rmrm command is used to remove the regular files. It will ask beforeremoving files.

rmdirit will remove the empty directory. If directory is full then use rm –rf

Ads by Google ► CCNA ► LinuxAds by Google ► MV ► UnixAds by Google ► Linux Red Hat ► RedHat RHCE

Basic Linux commands | Linux file system Basic commands |... http://computernetworkingnotes.com/linux-file-system-basic...

4 of 5 3/24/13 9:55 AM

Page 5: Basic Linux Commands | Linux File System Basic Commands | Study Guide | RHCE | Linux

< Prev Next >

[directory name]

Basic Linux commands | Linux file system Basic commands |... http://computernetworkingnotes.com/linux-file-system-basic...

5 of 5 3/24/13 9:55 AM