2015年5月31日 星期日

search installed application

Red Hat/Fedora Core/CentOS Linux

Type the following command to get list of all installed software
# rpm -qa | less

Debian Linux

Type the following command to get list of all installed software:
# dpkg --get-selections

Ubuntu Linux

Type the following command to get list of all installed software:
# sudo dpkg --get-selections

FreeBSD

Type the following command to get list of all installed software:
# pkg_info | less
# pkg_info apache
Use pkg_version command to summarizes the versions of all installed packages:
# pkg_version | less
# pkg_version | grep 'lsof'

OpenBSD

OpenBSD also use pkg_info command to display list of all installed packages or software:
# pkg_info | less
# pkg_info apache

2015年5月28日 星期四

express_example_setup_locally

$ mkdir myapp
$ cd myapp
$ npm init
$ npm install express --save
$ npm install express


export NODE_PATH=/usr/local/lib/node_modules

=======================
=======================

helloworld.js


var express = require('express');
var app = express();
app.get('/', function(req, res){
  res.send('Hello World');
});
app.listen(80);

2015年5月27日 星期三

mount ubuntu ,共用資料夾,share folder

mount -t vboxsf folderInMac folderInUbuntu

express node.js problem ubuntu



express expressproject
cd expressproject
npm install

install dependencies:
 $ cd mytestapp && npm install

run the app:
 $ DEBUG=my-application ./bin/www

npm cheat sheet

Listing globally installed NPM packages and version

npm list -g --depth=0





2015年5月24日 星期日

network monitor linux, command lsof

http://www.tecmint.com/10-lsof-command-examples-in-linux/


1. List all Open Files with lsof Command



2. List User Specific Opened Files


3. Find Processes running on Specific Port


4. List Only IPv4 & IPv6 Open Files


6. Exclude User with ‘^’ Character


7. Find Out who’s Looking What Files and Commands?


8. List all Network Connections


9. Search by PID


10. Kill all Activity of Particular User






2015年5月21日 星期四

log sources.list




cat /var/log/auth.log 

cat /etc/apt/sources.list

perl: warning: Setting locale failed. debian




$ sudo locale-gen
$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_HK:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_HK.UTF-8"
    are supported and installed on your system.

perl: warning: Falling back to a fallback locale ("en_HK.UTF-8").

node.js install and hello world

curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs

apt-get install -y build-essential


example.js

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

result
% node example.js
Server running at http://127.0.0.1:1337/

create group, add user

groupadd groupname

gpasswd -a user1 groupname
gpasswd -a user1 groupname

add user to sudo group



sudo adduser username
sudo adduser username sudo