Google

Tuesday, February 12, 2008

Basic Linux commands

On this tutorial, you will learn the basic commands in Linux CLI specially for those who are new in Linux.

ls
- display all files in the directory.
ls -l
- display file(s) with details,such as permission,owner of the file,date and time created,etc.









cd
- similar in DOS command. Change the directory you are working









pwd- (present working directory) Check on what directory your are currently in.









cp-
copy file fro
m one directory to other or same directory. If you want to copy file1 to file2 type cp file1(source) file2(destination). But if you want to copy in other directory, simply type cp file1 /dir/file2(or /dir if same file name)









rm-
same as del in DOS command. Type rm followed by the filename you wish to delete . You can use rm -f(force) to delete the file without asking confirmation.This is advantage specially you are deleting more files. Type rm -r to delete the entire folder. To delete multiple files with common extension type rm -f *.(txt,zip etc).











mv
- same as move in DOS command. Type mv file1(source) /dir(destination). There's no renaming command in linux CLI but you can rename by using this command, mv file1 file2(same or other directory) then the source file will be deleted









mkdir
- create new directory. Type mkdir newdirectory.
rmdir - delete a directory. Type rmdir existingdirectory.









man- display information of a linux command. Type the command man followed the by linux command you wish to know more about the use of that command.
Ex: show all information about cat











clear-
clean up the command prompt window.
cat-displaying the content of selected file without pausing the screen until it reaches the end of the file.







more-
same way as cat but it will display the file content per page by hitting the space and per line by hitting the Enter button.













less-
more useful than cat and more command. The same way with more but you can scroll up and down the content by hitting arrows and space bar.




No comments: