viernes, 10 de octubre de 2014

Print odd and even lines from a file

sed -n 2~2p filename
will print even-numbered lines from filename
sed -n 1~2p filename
will print odd-numbered lines.

Source: http://unix.stackexchange.com/questions/26723/print-odd-numbered-lines-print-even-numbered-lines

jueves, 9 de octubre de 2014

Create a new user

Type:

useradd username

Set a password:
 
passwd username


To create a new user with directory add -m option

Set up bash as default shell

chsh -s /path/to/shell {user-name}

$ which bash (to kwnow the path to bash)

Source: http://www.cyberciti.biz/faq/howto-set-bash-as-your-default-shell/

lunes, 8 de septiembre de 2014

Delete files from subdirectories


Delete files of a given type:


(example with *.files):


find . -name \*.swp -type f -delete



Delete files by name:

find . -name "file_name.ext" -delete

miércoles, 4 de junio de 2014

Tinyviz codes

export DBG=usr1,usr2

tinyviz -gui -nosf -noconsole -run "/opt/tinyos-1.x/apps/cdShortestPath__copie20-sep/build/pc/main.exe -rf=/opt/tinyos-1.x/apps/topology.nss -b=0" 40