Linux Basic Commands

This article have a simple commands and its function for further support, you can contact our support.

 

cd          

Change directory. This command permits you to move about to different directories on the server only by keying cd and then the wanted directory that happens. Example: cd /home

pwd      

Shows you an output of your present location on the server in shell

ls

Lists non hidden files in the present directory you are in on the server.

ls -al

Lists all files in current directory presentation authorizations, user, group, date adapted, hidden files, etc.

touch

Will create a new text file. When using this command you will need to contain the text file name and extension such as .txt, .php, .html etc. Also please note this command will make the file in the present directory you are in unless stated a location.

rm

rm will remove a file stated in the command. For example: rm newtextfile.html. When doing this command it will quick you if you are sure you want to delete that file. RM also has several choices you can use. Some options are: -f (force), -r (recursive), -d (directories), -i and -I do different things. -i will quick before removal and -I will prompt before removing more than 3 files.

mkdir

This will create a new directory in the location you are currently at in shell.

rmdir

Remove a directory. It must be blank in order to run this. However you can run the next to remove an whole directory with all content inside: rmdir -rf directory name

mv

MV will let you to move a file to another location on the server. This command will also let you to rename the file when moving it to additional location. Example: mv /home/newfile.txt /root/newfile_renamed.txt

cp

cp will copy files to another location on the server specified in the command. You can also copy directories recurrsevily as well by doing the following: cp -ar /starting/example/location /destination/location

chmod

Will modify permissions to a file/directory. Example: chmod ### /location/of/file.html; chmod ### /location/of/directory will modification the permissions of the directory but not the files in that directory. To change recursively you will want to do the following: chmod -R ### /directory.

chown

Changes the owner and group of a file. As with whatever else with Linux, most commands have variable options for their usage. For example: chown -R user:group /public_html/; The -R will recursively change ownership of all files and files with in the registered directory.

man

man will open up a manual with in shell and provide you further clarification on the command you are annoying to run. For instance if we want to know more about rm, we can run man rm and a manual will open.

cat

display contents of a file. Example: cat filename.txt

tail

displays the last 10 lines of a file. You can display more than 10 lines if desired by running: tail -n # filename

Text editor options

vi, vim, nano all will allow you to edit text files. Each have their own commands to operate with in them. To learn more about each check out their man pages.

 

apt-get

apt-get depending on the options allow you to look for, install, upgrade, etc packages on to your server through shell.

grep

command used to search files for the occurrence of a string of characters that matches a stated pattern. For simple example: grep root /etc/passwd; this will provide us any lines with in passed that contain “root”. Grep is also a very powerful tool that has many options to increase searching capabilities with in a file and simplify the output.

find

Searches the directory tree rooted at each given starting-point by assessing the given look from left to right, according to the rules of superiority until the consequence is known. If no starting point is is specified ‘.’ is assumed as the starting point. Find can also be a very powerful tool used together with other commands such as grep. Example: find . –name “*.php” | grep –i config

 

One thing to must remember with Linux command line, is “tab”. The tab key on your keyboard will provision you in finishing any directory or file names. Dual tapping tab will also provide you a print out of any file or directory with those characters in the start of the name you are annoying to use in your string. See example below:

 root@           [/]# cd Lib
Lib/          Lib64/
root@          [/]# cd  Lib

Remember, Linux can be a very powerful operating system when utilized to its full range. The command line can do additional than any user edge can provide you. With these commands to start you out, Linux offers a lot of capabilities to the user via command line.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

List of Common Available Ports On Cloud And VPS Servers

Inside our Cloud and VPS hosting services we want to make assured our clienteles have the skill...

Cloud Hosting VS. Shared Hosting

Shared hosting is the general hosting solution. But using a shared hosting solution user has to...

How to block IP using .htaccess file?

1) You may block entrance to your website from particular IP addresses using .htaccess file.2)...

How to Delete a cPanel Account From SSH

You can also terminate an account using SSH/command line if wanted using the following script....

How to Delete a cPanel From WHM

Eliminating an existing cPanel account is a very fast and easy process, but be advised this move...