Change to previous directory using cd command
Answer:
Using cd -, you can easily change to the previous directory
john@localhost:/usr/bin $ cd /tmp
john@localhost:/tmp $ cd -
/usr/bin
john@localhost:/usr/bin $
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Change to previous directory using cd command
Answer:
Using cd -, you can easily change to the previous directory
john@localhost:/usr/bin $ cd /tmp
john@localhost:/tmp $ cd -
/usr/bin
john@localhost:/usr/bin $
Install GD Library for PHP on Linux
Answer:
To install GD Library for PHP on Linux
1. Fedora/CentOS
# yum install php-gd
Then restart Apache
# service httpd restart
2. Debian/Ubuntu
# sudo apt-get install php5-gd
Then restart Apache
# sudo /etc/init.d/apache restart
How to use pipe in Linux
Answer:
Pipe | is very useful when you want to redirect the output of a program as an input of another program.
The combinations of using pipe in Linux is almost unlimited.
Some common usage:
1. count the number of lines in a file
cat test.txt | wc -l
2. read a very large text file
cat large.txt | less
3. filter filename from find util
find -type f | grep foo.txt
How to redirect output to a file
Answer:
Use the > for output (standard output) redirection, e.g.
echo "foo" > bar.txt
Convert IP address to unsigned integer in MySQL
Answer:
To convert an IPv4 address string, such as 127.0.0.1 to an unsigned integer, you can use the INET_ATON function in MySQL.
mysql> SELECT INET_ATON('127.0.0.1');
+------------------------+
| INET_ATON('127.0.0.1') |
+------------------------+
| 2130706433 |
+------------------------+