Thursday, July 4, 2013

Learn ubuntu/Linux with me -Day 1

I've been working on ubuntu since 4 years or so,It's time to write a blog with some screen shots.There's a wonderful book which is free,if you've time then go ahead and read for yourself.
Let's dive in.
Problem that you'll face: 
Typing... you need to type a lot of commands don't use mouse it's not for hackers it's for  dummies,the solution for this is given at the end,but for now for very first time you need to type every command.

Click on the images for a better enlarged view



Type this to fire up your Terminal
ctrl+alt+t

or you can search Terminal from the dashboard.


Commands that we'll discuss today.Just enter this in your terminal.
Just enter these commands in terminal.I tried to explain with examples,check the screenshots for a better understanding
Just do these
Command What it does
date displays current date
cal displays current month calender
pwd Displays Present working Directory
cd <dirname> changes to the dirname directory
ls Lists all files and directories
file <filename> Displays the type of file
less <file_name> shows the content of file
***** <file name> ===> name of the file without '<' or '>' symbols,but the file should exist.
If your a noob then create a directory on your desktop.Inside it create a text file.
now use this command
cd Desktop/directoryname
now type ls in your terminal
ls will display the name of  the text file
**** file names/ dirnames shouldn't contain spaces..if they have space then you need to use double quotes. cd "ajay kumar" or ls "ajay kumar"


Frequently used:
pwd ==>present working Directory
cd ==> Change directory
ls ==> Lists all directories and files
Less Frequently used:
file <file name> ==> Determine File type
less <file name> ==> View Contents. 

In the screen shot below you'll see cam@hac3er:~$ This may vary for you,you may have some thing like this==> 'username@computer-name:~$'




cd Desktop ==> will take you to the Desktop directory.[ cd<space>dirname ]
dirname here is the directory name.The directory name is case sensitive.Desktop is different from desktop.

How the heck I know the directory name? Use the command ls It lists all the directories and files.
cd .. ==> takes you back to previous directory;
cd-- ==> will take you to home directory. 


Create a text file[ajay]/download an image file from internet
cd Desktop
file ajay
It will give you the type of file.
less ajay
The above command will display the content of that file.
To come out of less input q from keyboard

Don't name a file with space trust me on this.If you've a space in your directory or a file you need to use double quotes.

 

Solution for the Problem:
Use up and down arrows to move around the previous commands,Terminal Emulators can save upto 500 command history.
Once you move those arrows you can edit a part of command by pressing backspace.
Learn python for fun.The popular blog with questions and answers to the python.Solutions to facebookhackercup,codejam,codechef.The fun way to learn python with me.Building some cool apps.

No comments:

Post a Comment