Sunday, August 29, 2010

Learn Linux from Scratch


First things First
==============

  • Linux is not completely free (some Linux Distros)
  • One OS many communities/Organisations Unlike Windows by Microsoft
  • Linux provides more security compared to windows
  • more will follow.....
Comming to Linux
================

  • Linux starts with "/". So location of any file will start from / , unlike windows where you have paths like C:\xyz\asd\abc
  • Swap refers similar to RAM. Optimal size of Swap Partition should be Twice of RAM
  • You cannot execute .exe files directly using Linux. However you may do that by using some third party softwares like WINE.
  • Linux is case sensitive.

Some commands
=============
pwd - present working directory
bc - calculator

for calculating floats in bc calculator.
Enter the line scale=1 (1,2,3......refers to the no. of places after decimal)


Going somewhere
===============
  • cd - it goes to the path you enter in
  • .. means one step backward. example: cd ..
  • . represents current directory
  • Here you need to know two things: Absolute path and Relative path
Suppose u are in a directory A (Which is in /)which has another sub-directory under the Name B. If you are in B and you need to go to B.Then you can follow two ways.

1. Absolute path(Complete path mentioned): cd /A
2. Relative Path: cd ..

Listing the Contents:
==================
  • ls - lists the contents of a directory.
  • use ls -l to view the permission of the contents along with links and ownerships.
File creation:
===========
  • touch - creates an empty file
  • cat > - you can enter some text in the file. Then press Ctrl+D to save.
  • vi or simply vi
It will open up a text editor where you can insert some text by going to the insert mode.
For going to the insert mode... press "I"
After writing press "Esc" (escape)
Then if you want to:

quit without saving then press: :q
Save and quit: :wq

-->for creation of hidden files use "." in front of the file name. Say like....
cat > .debraj

-->cat > cannot be used to modify an old file rather vi should be used

Directory Creation:
=================


mkdir (directory_name)

Creates a directory.


For creating multiple directory within the same location

mkdir a b c

Multiple directories in different locations

mkdir a a/b a/b/c a/d

it will create directories a,
directory b under a,
directory c under b,
Directory d under a.

you can also use relative path here....like


mkdir . ./b ./b/c ./d


Read a file
=========

cat (filename)



Copying a file
===========


cp (sourcefilename) (destinationfilename)

The above code should be used if the source file is in current directory.
else

cp (full or relative path of source) (full or relative path of destination)


Moving a file
============
mv (sourcefilename) (destinationfilename)

use the above technique if you are in the source file's Directory. Else do as in case of the last command.

Move command can also be used to rename a file.



No comments:

Post a Comment

Featured Post 1

notice

Featured Post 2

IETE

Featured Post 6

results

Featured Post 7

WBUT

Featured Post 3

Featured Post 4

Featured Post 5

Featured Post 8