@basic command

Basic command line of ubuntu/linux operating system
1. to show list file:

$ ls -lsr


2. to swap directories to the previous working directory

$ cd -


3. to delete all files

$ rm *


4. to delete every instance of a matching filename pattern from the current directory

$ rm –rf filename.*


5. to display the file contents directly on the screen

$ more filename
$ less filename


6. to use ls –l to display a list of files but it keeps scrolling off the screen, you can pipe the output from the ls –l command into the input of the more command by using the | character.

$ ls -l | more


7. to save the output of that list directly into a file.

$ ls -l > output.txt


8. cat command to display the contents of that file, pipe that into the grep command and then redirect that output into a separate file:

$ cat nc6build.sh | grep sh > output.txt


9. to show recently used command

$ history


10. to loop through a set of filenames and perform an action on each one, you can use the for command to loop through a set of files.

$ for f in *.txt;do echo $f;done


11. to find all files with .txt in the name that were modified in the last 5 days.

$ find . –name "*.txt" –mtime 5


12. to quickly find text within files, even searching through subdirectories.

$ grep -ir "seraching text" *


13. to quickly rename files using a regular expression pattern. For instance, if you wanted to rename all files containing foo to contain bar instead, you could use a command like this one

$ rename –v 's/foo/bar/g' *


14. to see a list of system processes

$ ps aux

15. to kill the running process

kill 

16. unpack the archive/zip in any directory

tar xfz eclipse-jee-ganymede-SR1-linux-gtk.tar.gz

17. point a folder directory

ln -s /usr/home/palash/douments documents
Advertisements

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