Category Archives: Ubuntu

Summary ubuntu cheat sheet

Summary ubuntu cheat sheet

Summary ubuntu cheat sheet that include commands, configuration,..

MYSQL:

Ngnix Server:

OR

CRONTAB

then enter these content:
* */2 * * * sh /pathto/file.sh

Ctrl + X to save and restart crontab service

Read more about crontab

Check disk space:

Install Phantomjs:
Following step from phantomjs to build lastest version.

Some cases, it will be failed because disk space, RAM is low

Install php5-curl:

Ubuntu Apache default Paths

Fix error “Invalid command ‘ExpiresActive’, perhaps misspelled or defined by a module not included in the server configuration”:

Show ubuntu version:

Install Python 3.5 on Ubuntu 14.x:

Numpy installation:

 

Create aliases:

go to /home/user_account then

then update with some lines as the following:

to get this work we must reload bash_aliases

Show all files:

Run python with apache cgi:

firstly, we need to enable cgi module for apache

next,

and create a index.py as the following lines:

then restart apache2

finally, run your file on browser with url http://my.python.dev to check!

Block IP:

Unblock IP:

Show IpTables list:

Install C/C++:

Check location and version what installed:

test1.c with content:

Complie and create execute file:

try to run:

C++ is the same use g++ to compile and run:

create test2.cpp

 

Vim Commands:

Find string in file content:

grep -rnw ‘/path/to/somewhere/’ -e “pattern”
-r or -R is recursive,
-n is line number, and
-w stands match the whole word.
-l (lower-case L) can be added to just give the file name of matching files.
Along with these, –exclude or –include parameter could be used for efficient searching. Something like below:
grep –include=\*.{c,h} -rnw ‘/path/to/somewhere/’ -e “pattern”
This will only search through the files which have .c or .h extensions. Similarly a sample use of –exclude:

grep –exclude=*.o -rnw ‘/path/to/somewhere/’ -e “pattern”
Above will exclude searching all the files ending with .o extension. Just like exclude file it’s possible to exclude/include directories
through –exclude-dir and –include-dir parameter; for example, the following shows how to integrate –exclude-dir:

grep –exclude-dir={dir1,dir2,*.dst} -rnw ‘/path/to/somewhere/’ -e “pattern”

Example:

Update && install node js

  • install node js 6.x for ubuntu:
  • install node js 7.x for ubuntu:

  •