Tag Archives: Linux Server

What are symlinks / symbolic links in Linux / Unix?

Symlinks are used a lot in Linux- and Unix-based systems so you may be wondering as to what exactly a “symlink” is.  If you have Linux VPS Hosting and you use SSH, you’ll often find many files in the file structure are symlinks.

What are symlinks used for?

Symlinks are a specific type of file that has a reference to a physical location on the Linux server hard drive – such as another file or directory that exists on the machine’s hard drive. The most common symlink you’ll likely come across when using an FTP client is the www and public_html directories. The www directory is a symlink to the public_html physical directory. So this means any files or directories uploaded to the www folder is the same as doing so directly in the public_html folder. The two that seemingly look like two separate folders are merely just one. read more

Uses Of SSH Client Commands In Your Linux Server

Uses Of SSH Client Commands In Your Linux Server :

SSH allows you to connect to a remote computer – for example, your Web server. This protocol allows commands to be carried out on that computer, such as moving and copying files, creating directories (folders), and running scripts. A SSH client should be installed on your computer to be able to talk to the remote server.

A. The ls command

LS is stands for “list”. Ls helps user to lists all the files and directories in their current directory. User have to type ls and press Enter to find out a listing appear in the terminal window:

[email protected]:~$ ls
myfile.txt   myfile2.txt   mysite.com

B. The cd command

Cd stands for “change directory”. User can able to to move into and out of directories, much like double-clicking folders on his/her PC with cd command. Such as, if ownsite.com listed above is the directory containing user’s website, he/she can move into the directory as follows:

[email protected]:~$ cd ownsite.com

User can then do another ls to list the contents of the ownsite.com directory:

[email protected]:~/mysite.com$ ls
cgi-bin   htdocs   logs

To move back up a directory, use cd .. (“..” means “the parent directory”). After use this, user can be back in original directory:

[email protected]:~/mysite.com$ cd ..
[email protected]:~$ ls
myfile.txt   myfile2.txt   mysite.com

C. The pwd command

Its important to know your exact current directory. To find this out, type the command pwd (short for “print working directory”) and press Enter. The computer displays the full path to the current directory.

[email protected]:~$ pwd
/home/users/username/

D. The more command

To quickly browse through the contents of a text file on your server. Just type more followed by the name of your file, and press Enter:

[email protected]:~$ more myfile.txt Project Gutenberg's The Complete Works of Artemus Ward, Part 1 #1 of this seven part series by Charles Farrar Browne Copyright laws are changing all over the world, be sure to check the laws for your country before redistributing these files!!! Please take a look at the important information in this header. We encourage you to keep this file on your own disk, keeping an electronic path open for the next readers. Please do not remove this. This should be the first thing seen when anyone opens the book. Do not change or edit it without written permission. The words are carefully chosen to provide users with the information they --More--(16%) read more

Uses Of Grep Command In Unix And Linux Server

Uses Of Grep Command In Unix And Linux Server

The name, “grep” is indicative of the operation which this command performs. It is executed using the Unix/Linux text editor ed: g/re/p

* grep Command Syntax

grep'word' filename
grep'string1 string2'  filename
cat otherfile | grep'something'
command | grep'something'
command option1 | grep'data'
grep --color 'data' fileName

* Way To Search File With grep Command :

Search /etc/passwd for boo user:
$ grep boo /etc/passwd

User can force grep to ignore word case. Such as, match boo, Boo, BOO and another combination with -i option:
$ grep -i "boo" /etc/passwd read more

Process To Check LAMP Version

When managing several servers with different operating systems and versions, you might not be able to identify the LAMP version being used, it could happen with the client too. Here is a small method to check the LAMP version.

1) Linux Version:-
[[email protected] ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.1 (Santiago)

[[email protected] ~]# uname -a
Linux node1.oriensoft.com 2.6.32-042stab032.1 #1 SMP Sat Aug 13 18:16:00 MSD 2011 x86_64 x86_64 x86_64 GNU/Linux

As per above out put Operating System is RHEL 6.1 (64-Bit). read more

Uses of Tar Command in Unix and Linux Server

Uses of Tar Command in Unix and Linux Server :

For archiving purposes on the Unix platform, tar command is command to be used. Knowing the various tar command options will help you to be a master of the archive file manipulation.

A. Create an archive with tar command

* Create an uncompressed tar archive with option cvf

It is the most basic command to create a tar archive.

$ tar cvf archive_name.tar dirname/
Note :
c – create a new archive
v – verbosely list files which are processed.
f – following is the archive file name

* Create a tar gzipped archive with option cvzf

The above used tar cvf, can’t offer any compression. So, if you want to utilize a gzip compression on the tar archive then you can utilize the z option as follows.

$ tar cvzf archive_name.tar.gz dirname/
Note :
z – filter the archive through gzip

Note:

.tgz is similar as .tar.gz

* Create a bzipped tar archive with option cvjf

Create a bzip2 tar archive as shown below:

$ tar cvfj archive_name.tar.bz2 dirname/
Note :
j – filter the archive through bzip2

Note:

.tbz and .tb2 is similar as .tar.bz2

B. Extracting (untar) an archive with tar command

* Extract a *.tar file with option xvf

Extract a tar file with option x as shown below:

$ tar xvf archive_name.tar
Note :
x – extract files from archive

* Extract a gzipped tar archive ( *.tar.gz ) with option xvzf

Use the option z for uncompressing a gzip tar archive.

$ tar xvfz archive_name.tar.gz

* Extract a bzipped tar archive ( *.tar.bz2 ) with option xvjf

Use the option j for uncompressing a bzip2 tar archive.

$ tar xvfj archive_name.tar.bz2

C. Listing an archive with tar command

* View the tar archive file content without extracting with option tvf

You can find out the *.tar file content before extracting as shown below.

$ tar tvf archive_name.tar

* View the *.tar.gz file content without extracting with option tvzf

You can find out the *.tar.gz file content before extracting as shown below.

$ tar tvfz archive_name.tar.gz read more

Way To Increase Remote Session Time In Your Linux Server

Increase Linux server remote session time :-

Put the below option in sshd_config file under /etc/ssh/ directory.

ClientAliveInterval 180

[[email protected] ~]# cd /etc/ssh/
[[email protected] ssh]# pwd
/etc/ssh
[[email protected] ssh]# ll
total 200
-rw——- 1 root root 132839 Mar 31 2010 moduli
-rw-r–r– 1 root root 1827 Mar 31 2010 ssh_config
-rw——- 1 root root 3324 Nov 18 18:30 sshd_config
-rw——- 1 root root 668 Nov 17 00:49 ssh_host_dsa_key
-rw-r–r– 1 root root 590 Nov 17 00:49 ssh_host_dsa_key.pub
-rw——- 1 root root 963 Nov 17 00:49 ssh_host_key
-rw-r–r– 1 root root 627 Nov 17 00:49 ssh_host_key.pub
-rw——- 1 root root 1675 Nov 17 00:49 ssh_host_rsa_key
-rw-r–r– 1 root root 382 Nov 17 00:49 ssh_host_rsa_key.pub
[[email protected] ssh]# read more

Installing Ioncube Loader In WHM

IonCube is a PHP-Encoder which is very useful to secure and license the php applications/scripts. Following steps can be used to install IonCube Loader to a Linux server.

RETRIEVE THE LATEST IONCUBE LOADER PACKAGE

FOR 32BIT (X86) ARCHITECTURE

[[email protected] ]# wget http://downloads2.ioncube.com/loader_download /ioncube_loaders_lin_x86.tar.gz
[[email protected] ]# tar -zxf ioncube_loaders_lin_x86.tar.gz
[[email protected] ]# mv ioncube /usr/local

FOR 32BIT (X86-64) ARCHITECTURE

[[email protected] ]# wget http://downloads2.ioncube.com/loader_download /ioncube_loaders_lin_x86-64.tar.gz
[[email protected] ]# tar -zxf ioncube_loaders_lin_x86-64.tar.gz
[[email protected] ]# mv ioncube /usr/local read more

Linux Based Disk Errors For Badblocks

Server offen face problems with Hard disk drives and one of them is bad blocks. Bad blocks can occur in the HDD due the intensive I/O reads and I/0 writes in HDD. To check the Bad blocks in a Linux server, following command needs to be executed in the server.

$ badblocks /dev/fd0H1440 1440 >
bad−blocks
$ fsck −t ext2 −l bad−blocks
/dev/fd0H1440
Parallelizing fsck version 0.5a (5−Apr−94)
e2fsck 0.5a, 5−Apr−94 for EXT2 FS 0.5, 94/03/10

Pass 1:
Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Check reference counts.
Pass 5: Checking group summary information. read more

Steps To Kernel Update With rpm

If you want to update your kernel with rpm then you have to follow the following steps :

1. log-in to your Linux Server with your root access.

2. Run the following command to find out recent kernel availability on your server.

#uname -r

3. You have to edit grub.conf to new kernel availability.

4. Run the following command to download latest kernel version from kernel.org

http://rpm.pbone.net/index.php3/stat/3/srodzaj/2/search/kernel-2.4.21-47.0.1.EL.src.rpm
rpm -ihv kernel-smp-2.4.21-47.0.1.EL.i686.rpm read more

Way To Install And Configure Configserver Firewall

You can install configserver firewall on a linux server with the following steps :

1. Run the following command :

rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

2.If you would like to disable APF+BFD (If you have them installed then you will require it else they will conflict horribly):

sh disable_apf_bfd.sh

3. Now, you have to configure csf and lfd in WHM, or edit the files

directly in /etc/csf/*

4. CSF provides a pre-configured setup for the cpanel servers, it automatically configures all the relevent ports in csf which are used for the proper working of cpanel. read more