When you are developer, You are using Linux command on daily basis. Sometimes, you have face to find out some different Linux command with so many other resources. Here, I will provide you all useful command list for Linux.
You may also like this :
How to Install PHPMyadmin :
sudo apt-get update
sudo apt-get install phpmyadmin
How to Restart Apache2 Server :
sudo service apache2 restart
How to Start Apache2 Server :
sudo service apache2 start
How to Stop Apache2 Server :
sudo service apache2 stop
How to Check Apache2 Status :
sudo service apache2 status
How to Check PHP version :
php -v
How to Install PHP 7.4 :
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.4
You can set install any PHP version by PHP version instead of php7.4
How to Install useful PHP Extensions :
sudo apt-get install php7.4-gd php7.4-mcrypt php7.4-curl php7.4-intl php7.4-xsl php7.4-mbstring php7.4-openssl php7.4-zip php7.4-soap php7.4-bcmath php7.4-cli php7.4-json php7.4-mysql php7.4-xml
Check Current Directory Path :
pwd
Move File into Folder :
mv test.php temp/
Here, test.php is file which will be move into temp folder.
mv test/ temp/
Here, test is folder which will be move into temp folder.
Copy File into Folder :
cp -R test/time.php test1/temp.php
Here, time.php file will be copy on test1/temp.php path.
Check difference of two files :
diff test/time.php test1/time.php
Remove / Delete files from directory :
rm -rf var/log/*
Find specific keyword from files :
- From single directory :
grep -r "test" app/
- From multiple directory :
grep -r "test" app/ vendor/
- To show list of files of find keyword :
grep -rl "test" app/
- Find word from specific type file :
grep -r "test" app/ --include=\*.php
This above command will find keyword from .php file only.
- Find word from multiple type files :
grep -r "test" app/ --include=\*.{php,js}
This above command will find keyword from .php & .js files only.
- Find word except specific type file :
grep -r "test" app/ --exclude=\*.php
This above command will find keyword except .php file.
- Find word except multiple specific type file :
grep -r "test" app/ --exclude=\*.{php,js}
This above command will find keyword except .php & .js files.
To Lists all the contents in the current working directory :
ls -l
To Lists all the contents with hidden files in the current working directory :
ls -la
To create new directory :
mkdir test
To find file in specific directory :
find m243/app/ -name env.php
This will find env.php file from m243/app/ directory.
Change PHP version from 7.2 to 7.4 :
sudo a2dismod php7.2
sudo a2enmod php7.4
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.4
That’s it !!
I hope this blog is helpful to your for Linux useful commands list. In case, I missed anything or need to add some information, always feel free to leave a comment in this blog, I’ll get back with proper solution.