List of Linux Commands

  

This topic is the continuation of my previous post. I have explained on How To Use PuTTY SSH Windows. Now, this following Linux Commands probably will help you manage and modify files and permission on your Linux Server.

help command – Display brief info on a bash (shell) build-in command. Just type “help”.

Navigating Files, Folders and Directory using Linux

command Description
cd - The cd command allows you to change directories. When you open a terminal, you will be in your home directory.
cd ~/Desktop To navigate to your desktop directory.
cd / To navigate into the root directory.
cd .. To navigate up one directory level.
cd - To navigate to the previous directory (or back).
cd /var/www To navigate through multiple levels of directories at once, use cd /var/www, for example, which take you directly to the /www subdirectory of /var.
pwd “Print Working Directory”. Shows the full path of the current directory.
ls Lists all the files in the current directory.
ls -al Lists all files and information.
ls –alR Lists all files and information in all sub directories
ls *.html Lists all files ending with .html
ls -d */ Lists all directories within current directory
cd foo Changes to a new directory, ex. directory name foo.
clear Clears the screen
vdir Gives a more detailed listing than the “ls” command

Creating, Moving Directory and File using Linux Commands

Command Description
mkdir [directory name] Creates a new directory
mv [old filename] [new filename] Move/rename a file

Deleting files and Directory using Linux Command

rm -r = (recursive remove) Remove files, directories, and their sub directories. Careful with this command as root–you can easily remove all files on the system with such a command executed on the top of your directory tree, and there is no undelete in Linux (yet). But if you really wanted to do it (reconsider), here is how (as root): rm -rf /*

command Description
rm [filename] Deletes a file
rm *.html Deletes all files ending in .html
rm -r filename.php filename.txt Removes filename.php and filename.txt files

Copy Files and Directory using Linux Command

The cp command is used to copy files and directories. The copies become independent of the originals (i.e., a subsequent change in one will not affect the other). When a copy is made of a file or directory, the copy must have a different name than the original if it is to be placed in the same directory as the original. However, the copy can have the same name if it is made in a different directory.

cp’s basic syntax:
cp [options] name/filename new_filename

cp -r [directory] [new directory] = Copies a directory and all files/directories in it.
ex. cp -r foo /home/rolan/foo – this will copy foo directory under rolan’s directory.

cp [filename] [new filename] = to copy file in the same directory.

Comments (1)


[...] List of Linux Commands [...]

Leave a reply

Name *

Mail *

Website