Tuesday, February 26, 2013

Some useful BASH shell hot keys and useful tips.

Check out these hot keys. They can help a lot to save your time.
Since I started using them, I'm just a new man :)

This one is so important, that I'll write it separately.
Ctrl+R To search in previous commands. It displays the last occurrence.
Ctrl+R+R It displays the occurrence before the last.

These commands are also very useful. When I say they are "useful", I really mean that I use them! :)
Ctrl+K To delete the characters from the cursor to the end of the line.
ESC+D To delete the characters from the cursor position to the end of the word
Ctrl+A To move the cursor to the beginning of the command line
Ctrl+E To move the cursor to the end of the command
Ctrl+L To clear the screen, puts the current command line at the top of the screen

And I've got one additional tip for you. Use aliases!
Don't be lazy. It's so worth it!
To create your own alias, edit the file ~/.bashrc. Put there your alias.
Here is my alias that I use very frequently:
 alias pr='cd /var/www/myprojects' 
In this file you can see already added aliases. To check them out, you can also use alias command.

Wednesday, February 20, 2013

How to get list of available timezones in php

<?php
    print_r( DateTimeZone::listIdentifiers( ) ); 
?>

Saturday, February 16, 2013

Some basic UNIX commands

Today I will write down some basic UNIX commands.
"cd -" will switch you to the previous directory.
testuser@test:~/Downloads$ cd ../Desktop/
testuser@test:~/Desktop$ cd -
/home/testuser/Downloads
testuser@test:~/Downloads$ 

"cd ~" or "cd" will switch you to your home directory.
testuser@test:~/Downloads$ cd ../Desktop/
testuser@test:~/Desktop$ cd -
/home/testuser/Downloads
testuser@test:~/Downloads$ 

"pwd" (print working directory) is used to output the path of the current working directory.
testuser@test:~/Desktop$ pwd
/home/testuser/Desktop