how-do-you-restart-apache
###################################
sudo /etc/init.d/apache2 reload
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
or
sudo apache2ctl graceful
MYSQL
####################
sudo /etc/init.d/mysql start
or
sudo service mysql start
How to move into another directory
####################################
cd [another directory] eg: cd niyaz
How to go to home directory
#########################################
cd ~
How go to the last directory you were in
############################################
cd -
How to go up a directory level
########################################
cd ..
How to show the full path of the current directory
######################################################
pwd
How to list files and/or directories in a directory
########################################################
ls (just type ls and hit enter)
How to list all files and information
##############################################
ls -al
How to list all files ending with certain extension
#############################################################
ls *.ext eg : ls *.php
How to list all files and folders with detailed information including file size
#################################################################################
ls -alh
How to quit and exit SSH client
########################################
exit
How to copy and rename file
###################################
cp [filename] [new filename]
example: we’ll rename banner.jpg to banner728px.jpg
cp banner.jpg banner728px.jpg
example: we’ll cope banner.jpg to a folder called “ads”
cp banner.jpg ads/banner.jpg
example: copying and renaming at once
cp banner.jpg ads/banner728px.jpg
ps: original file will remain, it is just copied.
How to move and rename file
#####################################
mv [old filename] [new filename]
example: moving a file to another directory
mv banner.jpg ads/banner.jpg
example: moving a file to another directory and renaming it at once
mv banner.jpg ads/banner728px.jpg
ps: original file will be deleted as it was moved to another location
pps: you can also move a folder
example: moving “image” folder to “media” folder
mv image/ media
example: moving “image” folder to upper directory
mv image/ ..
How to delete / remove a file
#####################################
rm [file name]
example:
rm banner.jpg
How to delete / remove all files in current directory
#######################################################
rm *
How to delete files with certain extension
##########################################################
rm *.extension
example: remove all files with .jpg extension
rm *.jpg
How to copy a folder with all files and folders in it
#########################################################
cp -r [directory] [new directory]
How to create new folder
###############################################
mkdir [folder name]
example:
mkdir image
How to search for a file starting within current directory
#################################################################
find . -name [filename] -print
example: find a file called “banner.jpg” in current folder
find . -name banner.jpg -print
How to search for text within a file
###############################################
grep [text] [filename]
example: find the word “sidebar” in file index.php
grep sidebar index.php
CHMOD – how to change file permission
##############################################
chmod [permission type] [file/folder name]
example:
chmod 777 config.php
Available permission type: (below is not command)
First number is for the owner, second for the group, and third for everyone.
7 = Read + Write + Execute
6 = Read + Write
5 = Read + Execute
4 = Read
3 = Write + Execute
2 = Write
1 = Execute
0 = All access denied
make a new file
#########################
touch sample.txt
open a file using vim
###########################
vim index.php
open a file using nano
#############################
nano index.php
show contents of the error log
####################################
cat /var/log/apache2/error.log
Show last few lines of the log
###################################
tail /var/log/apache2/error.log
Path to php.ini
#####################################
/etc/php5/apache2/php.ini
###################################
sudo /etc/init.d/apache2 reload
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
or
sudo apache2ctl graceful
MYSQL
####################
sudo /etc/init.d/mysql start
or
sudo service mysql start
How to move into another directory
####################################
cd [another directory] eg: cd niyaz
How to go to home directory
#########################################
cd ~
How go to the last directory you were in
############################################
cd -
How to go up a directory level
########################################
cd ..
How to show the full path of the current directory
######################################################
pwd
How to list files and/or directories in a directory
########################################################
ls (just type ls and hit enter)
How to list all files and information
##############################################
ls -al
How to list all files ending with certain extension
#############################################################
ls *.ext eg : ls *.php
How to list all files and folders with detailed information including file size
#################################################################################
ls -alh
How to quit and exit SSH client
########################################
exit
How to copy and rename file
###################################
cp [filename] [new filename]
example: we’ll rename banner.jpg to banner728px.jpg
cp banner.jpg banner728px.jpg
example: we’ll cope banner.jpg to a folder called “ads”
cp banner.jpg ads/banner.jpg
example: copying and renaming at once
cp banner.jpg ads/banner728px.jpg
ps: original file will remain, it is just copied.
How to move and rename file
#####################################
mv [old filename] [new filename]
example: moving a file to another directory
mv banner.jpg ads/banner.jpg
example: moving a file to another directory and renaming it at once
mv banner.jpg ads/banner728px.jpg
ps: original file will be deleted as it was moved to another location
pps: you can also move a folder
example: moving “image” folder to “media” folder
mv image/ media
example: moving “image” folder to upper directory
mv image/ ..
How to delete / remove a file
#####################################
rm [file name]
example:
rm banner.jpg
How to delete / remove all files in current directory
#######################################################
rm *
How to delete files with certain extension
##########################################################
rm *.extension
example: remove all files with .jpg extension
rm *.jpg
How to copy a folder with all files and folders in it
#########################################################
cp -r [directory] [new directory]
How to create new folder
###############################################
mkdir [folder name]
example:
mkdir image
How to search for a file starting within current directory
#################################################################
find . -name [filename] -print
example: find a file called “banner.jpg” in current folder
find . -name banner.jpg -print
How to search for text within a file
###############################################
grep [text] [filename]
example: find the word “sidebar” in file index.php
grep sidebar index.php
CHMOD – how to change file permission
##############################################
chmod [permission type] [file/folder name]
example:
chmod 777 config.php
Available permission type: (below is not command)
First number is for the owner, second for the group, and third for everyone.
7 = Read + Write + Execute
6 = Read + Write
5 = Read + Execute
4 = Read
3 = Write + Execute
2 = Write
1 = Execute
0 = All access denied
make a new file
#########################
touch sample.txt
open a file using vim
###########################
vim index.php
open a file using nano
#############################
nano index.php
show contents of the error log
####################################
cat /var/log/apache2/error.log
Show last few lines of the log
###################################
tail /var/log/apache2/error.log
Path to php.ini
#####################################
/etc/php5/apache2/php.ini
Post a Comment