Pick a Free OS

User login

Navigation

Linux Basics : First Steps Into Linux

the directory in which you presently are. It is used without flags

simply as \'pwd\'

The su command

Many a times you might have logged in as a normal used and might need

to be root to install a software or for some other small task. You

could logout then login as root complete the work logout and login

back as a normal user. Instead, you can just use the su command. The format

is :

su

username

eg : su root

when you \'su\' to become root from a normal user, you are asked for the

root password. But if you are root, you can use \'su\' to become any

user without using a password. Once your work is finished, use \'exit\'

to become yourself.

The whoami command

Sorry folks! This command won\'t solve your teenage identity crisis but

it will tell you which user you are logged in as. Useful when you

have used \'su\' many times and now don\'t know who you are.

The cp command

This one copies files / directories from one place to another it\'s syntax

is

cp

source_file_with_path destination_path

eg : cp /home/aarjav/secret.txt /ftp/pub

This would make all my secrets public :). But my secrets wouldn\'t fit

on my 8.4 Gb hard-disk ;) The cp command can be used with some useful flags

also :

cp

-i


Interactive copying, prompts before overwriting files or directories

cp

-l source_file_with_path destination_path


Makes a link (shortcut) to the source_file at the destination

path instead of actually copying it there.

cp -p

Preserve file attributes while copying if possible

cp -R

Copy Recursively . Used when copying directories.

This command also copies the contents of the subdirectories.

cp

-u

Update

i.e. Copy only if the source file is newer than the destination file

or the destination file does not exist.

The

rm command

The rm command is used to remove or delete files or directories. Its general

format is:

rm

-flag file_or_directory_with_path

eg : rm /home/aarjav/waste.txt

Some flags which can be used with the rm command are

rm -v file.txt

Remove

verbosely, explain what is being done.

rm -r my_directory

Remove

the directory and its contents recursively.