Archive for the ‘ Linux Distributions ’ Category

To switch / define your default editor type:
~# update-alternatives –config editor

There are 3 alternatives which provide `editor’.

Selection Alternative
———————————————–
1 /bin/ed
*+ 2 /bin/nano
3 /usr/bin/vim.tiny

Press enter to keep the default[*], or type selection number:

 

In some php 5 versions the flle upload is bugging by default.
Open php.ini and add the following line ( or uncomment if present but not enabled )
upload_tmp_dir = /tmp

 

To add php modules to your configuration you can easily
use your apt manager:

~# apt-get install php5-gd
~# apt-get install php5-curl

 

Monitoring your system basics
 
To check the disk usage on your system
~# df -h

To check the memory allocation and usage
~# free -m

To visualize your CPU information
~# cat /proc/cpuinfo

To check your network configuration
~# ifconfig

To visualize the running processes, CPU Load and Memory
~# ps aux

To see lifetime running processes
~# top
( type q to leave the program )

 

Setting File and Folder Ownership
 
Every file or folder belongs to an owner and a group
To change ownership use the syntax:
~# chown username:usergroup filename
~# chown username:usergroup foldername
To change ownership recursively, meanwhile all files inside a folder:
~# chown -R username:usergroup foldername
To check and visualize your changes type:
~# ls -hal

 

Setting File and Folder Permissions
 
Permission are represented by a 3 digit numerical code
First Digit: Owner
Second Digit: Group
Third Digit: Everybody

Permission 0 = no access
Permission 4 = read
Permission 6 = read / write
Permission 5 = read / execute
Permission 7 = read / write / execute

To set permissions use syntax
~# chmod 644 filename
Setting filename to read/write (owner) and read (group and world)
To set permissions recursively for all files inside a folder use
~# chmod -r 755 foldername
Setting foldername and all files inside to raed/write/execute (owner) and read/execute ( group and world )

You can restrict your settings and give permissions only for specified files
~# chmod 644 *.php
Setting all php files inside this folder to read/write – read – read

 

Copy / Paste files and folders.
– copy a file
~# cp filename1 filename2
A copy from filename1 is created in the same directory
~# cp /home/myweb/filename1 /home/hisweb/filename2
Creates a copy from filename1 into another directory and name filename2
To copy a folder use the -r ( recursive option )
~# cp -r folder1 folder2
~# cp -r /home/myweb/folder1 /home/hisweb/folder2

To copy and preserve the user and group rights use the -p flag
~# cp -rp filename 1 filename2
To show all options type:
~# cp –help

 

To move a file or to rename a file use:
~# mv filename1 filename2
For folders addd the -r ( recursive ) flag
~# mv -r folder1 folder2

 

To create a dump file use the following syntax:

/var/lib/mysql # mysqldump -u root -p mysqldatabase > backup.sql

You will be prompted for the password and the backup file will be created.

————————————————————————-

To restore a backup dump file use the following syntax:

/var/lib/mysql # mysql -u root -p mysqldatabase < backup.sql

You will be promted for the password and the backup will be restored.

 

To change date and time on your shell manually you need type the following code:

~# date --set 2008-11-19
~# date --set 15:25:0

Make sure to respect the syntax.
 

I experienced this problem on VPS Debian 4.0 Etch:

——————————————————————————-
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
——————————————————————————-

Locale is a framework to switch between multiple languages for users who
can select to use their language, country, characters, collation order,
etc.

I noticed that i couldn’t install the Squirrelmail language modules.
How to fix:

~# apt-get update
~# apt-get upgrade
~# apt-get install locales
~# dpkg-reconfigure locales

Now i experienced that the reconfigure script was bugging and needed
do it manually:

~# ln -s /usr/share/i18n/SUPPORTED /etc/locale.gen
~# locale-gen

It takes a little eternity but afterwards your system is updated and
supports multiple languages.