Some shell commands to charge you up …

Here’s a list of commands that might be useful as a newbie to the CLI and can actually get things working. I have not included a detailed description as you can get most help using the first command listed below :

1. man – SoS for the innocent

This command fetches the manual pages for the command/program you request (if there exist one).

Usage : man command

2. info – Another help program

This command (also) fetches help and documentation for the given command.I really don’t know the difference between the previous one and this one (some say info fetches more pages than man)

Usage : info command

3. date – Used to display the current date/time

Usage : date

4. cal – Command-Line Calendar program

Usage : cal [month] [year]

5. ls – List files and folders

Usage : ls

ls -a  – to display hidden files also.

6. pwd – Present Working Directory

Displays the present working directory.

Usage : pwd

7. cd – Change Directory

Change to specified directory.

Usage : cd [path]

8. cat – Display the contents of a file

Usage : cat [filename]

9. more,less – Is the text scrolling thru pages without waiting for you?

To view the the file page-by-page according to convinience.Difference between more and less is than more just displays the text page-wise and line-wise (you can’t go upwards, do a search, etc) and less allows you to perform all that.

Usage : OutputStream | [more/less]

| – Pipe

8. ps – Processes

Use this to view process that are currently running.

Usage : ps

ps -e  to see a complete list.You will use this most often.

9. vi – Text editor

Though a CLI editor. VI is much powerful once you get to know it. Such awesome functionalities once you know your way around.

Usage : vi

vi [file]

vimtutor – To have a tutorial on VI editor

10. file – Display file type

Usage : file [file]

11. touch – touch the file

Used to update the access timestamps of the file to current time.Also can create a empty file in case you need one.

Usage : touch [file]

12. mv,rm,cp – Move/Remove/Copy Files/Folders

mv is also used for rename.

Usage : mv/cp [source] [dest]

rm [file]

rm -r [folder] Recursive

rm -rvf [folder] Recursive/Verbose/Force(Be CAREFUL with this option)

13. mkdir,rmdir – No need for explanations

14. grepGlobal Regular Expression and Print

Used to search for text/pattern in the input stream

Usage : OutputStream | grep [pattern]

15. find – used to search for files and directories

If you wanna search deep down for a file, use :

find . | grep [filename]

16. wc – Word Count

17. gzip,bzip2,tar – File Compression/Extraction tools

See man pages for their usage format.For the most common tar files the uncompression command is:

tar -xvf [file]

18. ln – Create symbolic link (both Hard and Soft)

Hard Link – Use this if you want to create a link to a file/folder with a different inode.If you modify the link’s content, the changes are not reflected in the original file.Must exist in same filesystem.

Soft Link – If you want to create a link to a file just for sake of refering if from that location.Changes made are reflected in the actual file.

19. chmod, chown, chgrp – Change the file attributes

chmod (u/g/o)(+/-)(r/w/x) [filename]

20. <,>,2>,>> – Redirection Operator’s

Redirect <,>

Redirect Error 2>

Append to file >>

21. clear – Clear the screen buffer.

22. uname – Print system information

Usage : uname [options]

uname -a  – Print all information

23. du – View disk usage information

24. which – Used to see the location of a command – Usage : which [command]

25. whereis – Locate the binary, source and man pages of a command – Usage : whereis [command]

26. sort – Used to sort (asc/desc) a text stream

Ex: cat somefile | sort > sortedfile

27. diff – compare files line by line

FOSSwire.com has a developed a pdf summarizing this command :

http://fosswire.com/2008/04/22/ubuntu-cheat-sheet/

http://fosswire.com/2007/08/02/unixlinux-command-cheat-sheet/

Advertisements

~ by toolweb on May 27, 2008.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: