A shell is nothing but a script which is written for the shell, or command line interpreter, of an operating system. It is also considered as a simple domain-specific programming language which  includes different typical operations performed by shell scripts which include file manipulation, program execution, and printing text. In different terms shell is also named as a term for user interface, Operating systems and applications to provide an alternative shell interface to make interaction with the program easier. In simple terms if the application is usually command driven, the shell might be a menu-driven system that translates the user’s selections into the appropriate commands.

Lets see some basic Shell Commands for Linux administration

passwd : This command will make changes to your SSH account’s password, you just have to follow the options after typing change account password.
nano [option] [file]: This is a File editor, easy-to-use and very friendly.
nano –w /home/aquhome/public_html/index.php : your current editing

index.php with –w being non wrapping of long lines

mkdir [directory_name] : Used to create a directory with specific default permissions .

mkdir aquhome : Creates a directory aquhome in the current directory you are.

df : [attribute]

[b]df -h[b] : It is to show you the disk space available in human readable format (Mbit and Gbit)

cd : change directory
cd ~ : takes to your home directory
cd – : takes to the last directory you viewed
cd ../ : takes you one level up a directory
cd [directory path]
cd /home/aqhome/public_html

ls: This command lists files and directories in a directory.

ls –l : It will show all the files with detailed attributes.

vi : This commnad is used for advanced editor, having tons of features, but harder to use then nano

vi /home/aquhome/public_html/index.php : Editing that index.php file again

ln : Makes sys links between the files and directories

ln –s /usr/local/apache/conf/httpd.conf /etc/httpd.conf : This command will allow you to edit the /etc/httpd.conf instead of the original, changes will apply to the original immediately. You can delete the link without deleting the original.

wall : broadcast message
wall [message]
wall so whens the server being restarted?
top : It will shows endlessly updating system processes in a table.
w : Displays  ip address of the person and who has logged in currently.
ps : Displays the processes that are running.
touch : creates an empty file.
touch [file]
touch index.html : creates an empty index.html
kill : terminates a particular system process
kill -9 [PID] : You can get a PID by using Top.
kill -9 100545
cp : Used to copy a file
cp yourfile yourfile.copy : It will copies yourfile data  to yourfile.copy
cp –a /home/aquhome/public_html/* /home/aquhome/public_ftp/ : It is used to copies all files in public_html to /public_ftp
du : displays disk usage
du –sh : displays a summary of total disk space in the current directory along with the subdirectories in human readable form
netstat : displays all current network connections
netstat -rn : displays routing tables for IP’s.
netstat -an : displays all connections to the server.
chown : command to change the owner of a file
chown [attribute] newowner.newowner filenames
chown -R aquhome.aquhome /home/aquhome/public_html/index.php
chmod : [-r] permissions filenames

Permissions :
u – A User who owns the file.
g – A Group that owns the file.
o – Other.
a – All.
r – Reads the file.
w – Writes or edit the file.
x – Executes or run the particular file as a program.

Numeric Permissions:
CHMOD can also be attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
CHMOD 755 /home/aquhome/public_html/index.php
last : shows last logins to the system
rm : deletes a file
rm filename.txt : deletes filename.txt, will more than likely ask, if you really wish to delete it
rm -f filename.txt : deletes filename.txt, won’t ask for confirmation before deleting.
rm -rf tmp/ : recursively deletes the directory tmp, and all files in it. You need to be very carefull with this command.
grep : Search for patterns in files
grep root /etc/passwd : displays all matches of root in /etc/passwd
grep -v root /etc/passwd : displays all lines that don’t match root
wc : word count
wc -l filename.txt : shows how many lines are in filename.txt
mv : Moves a specific file.
mv -f /home/pen/ram.php /root/  moves  ram.php to the directory root

Basic Extracting Commands:
tar xvfz imagick-0.9.11.tgz : will extracts the .tgz file
bzip2 and bunzip: files with .bz2 extensions
bzip2 filename.txt : zips filename.txt to filename.txt.bz2
bunzip2 filename.txt.bz2 : unzips filename.txt.bz2 to filename.txt

Essential Service Commands:
service httpd restart : Restarts Apache
service mysql restart : Restarts MySQL
service exim restart : Restarts exim
service cpanel restart : Restarts Cpanel

The techsavvy technical team working at eUKhost deploys qulaity tech services with quick response to solve any problem. eUKhost also offers quality hardware and highly configurable Dedicated server UK with disaster recovery plans to host any small or large website with different technologies like VPS servers, Reseller hosting servers and UK Cloud hosting server to host your website with quick setup server guarantee and no downtime.

Leave a Reply