grep –colour “KEYWORD” | grep php searching for “KEYWORD” in php (name/file related) -r = recursively -n = show number of line in files -i = case insensitive -v = exclude
Vim Search & Replace
http://www.cyberciti.biz/faq/vim-text-editor-find-and-replace-all-text/ EX ~ :s/eth0/br0/g Search for current line to replace only EX ~ :%s/eth1/br1/g Search all occureance to replace
Nginx sites enabled procedure
cd /etc/nginx/sites-available/ cp vn.momoko.co um.momoko.co vim um.momoko.co cd /etc/nginx/sites-enabled/ ln -s /etc/nginx/sites-available/um.momoko.co /etc/init.d/nginx reload
SQL VS PHP (Object oriented connection)
HOW TO ESTABLISH THE CONNECTION WITH DATABASE $db = new mysqli(<HOST NAME>,<DB USER>,<DB PASS>,<DB NAME>); HOW TO EXECUTE QUERY $query = “YOUR QUERY”; $result = $db->query($query); HOW TO LIST YOUR QUERY RESULT while($row = $result->fetch_array(MYSQLI_ASSOC)){ echo “Hi ” .$row[‘Name’]. “, Your Email is” .$row[‘Email’]. ” and your phone number is ” .$row[‘Phone’] ; }
What will server search for the first things & Error log (nginx)
In nginx , the first file it will search for to open is the nginx index file.
Unzipping files & Zipping files
UNZIP BZ files , tar -xjf <Filename> GZ files, tar -xzf<Filename> ZIP tar -zcvf archive_name.tar.gz directory_to_compress Zip Command To compress: zip squash.zip file1 file2 file3 or to zip a directory zip -r squash.zip dir1 To uncompress: unzip squash.zip this unzips it in your current working directory.
Tmux Short Key
Session is a set of windows, plus a notion of which window is current. Window is a single screen covered with panes. (Once might compare it to a ‘virtual desktop’ or a ‘space’.) Pane is a rectangular part of a window that runs a specific command, e.g. a shell. ResizingPane Ctrl-b then [ then you […]
Executing .deb files
dpkg -i <filesname>.deb -i = Install