Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Tag Archives: Linux

Copy recursively directory structure using Linux Command


How to copy a directory/folder structures in a single command
Create a new directory
Cd new_directory
Run the following command
Where “../catalog” is the source location
***Remember to backup before running this script.

e.g

find ../catalog -type d -printf “%P\n” | xargs mkdir -p

find ../admin -type d -printf “%P\n” | xargs mkdir -p

Some Linux useful IP commands


Display Current Config for all NIC’s: ifconfig

Display Current Config for eth0: ifconfig eth0

Assign IP: ifconfig eth0 192.168.1.2

Ping: ping -c 3 192.168.1.1

Assign multiple IP’s: ifconfig eth0:0 192.168.1.2

Assign second IP: ifconfig eth0:1 192.168.1.3

Disable network card: ifconfig eth0 down

Enable network card: ifconfig eth0 up

View current routing table: route “or” route -n

View arp cache: arp “or” arp -n

Assign IP/Subnet: ifconfig eth0 192.168.1.2 netmask 255.255.255.0

Assign Default Gateway: route add default gw 192.168.1.1

Trace Route: traceroute http://www.whatismyip.com

Trace Path: tracepath http://www.whatismyip.com

DNS Test: host http://www.whatismyip.com

Advanced DNS Test: dig http://www.whatismyip.com

Reverse Lookup: host 66.11.119.69

Advanced Reverse Lookup: dig -x 66.11.119.69

*You MUST be at the ROOT user to make/save any changes. Linux users, your distribution will determine the location of your network config file which will need to be updated and saved in order for the changes to remain in effect after rebooting. Network cards are referred to as eth0, eth1, eth2, etc based on their position on the PCI bus.
*Special thanks to Gergely for the Linux commands!

 

Linux – Kill all processes for a user

How to restart cPanel service from command line – Linux Server?


In order to restart cPanel service from command line one need to execute below mentioned command:
[root@root ~]# /etc/rc.d/init.d/cpanel restart

To Recover Your Parallels Plesk Panel Password on a Linux Server


Using SSH, log in to your server with the User ID and Password that you created when you set up your dedicated hosting account.
At the command line, type su -.
For your password, use the same password that you use with your User ID.
Type cat /etc/psa/.psa.shadow
This file contains your admin Parallels Plesk Panel password.