Saturday, October 1, 2011

My note of UNIX Commands

Find content in files
============
find ./ -name "*.c" | xargs grep TEXT


ln
==
# Symbolic Link is very similar to what we know from Windows - a shortcut.
ln -s [full path to source directory] [target]

# Hardlink cannot be created for directories (folders).

Ref: http://www.maxi-pedia.com/difference+between+symbolic+link+and+hard+link


useradd
========
The options which apply to the useradd command are:
-g (primary group assigned to the users)
-s starting program (shell)
-p password
-d home directory
-m (Create the user's home directory

useradd -gusers -s/bin/bash -pshutdown -d/home/shutdown -m shutdown
passwd shutdown
usermod -a -G sudo shutdown


Set Console Font
=============
setfont /usr/share/consolefonts/Uni1-VGA8.psf.gz


tar zcvpf backup.tar.gz directory-name/
tar บนลีนุกซ์ สามารถระบุออปชั่น z เพื่อบีบขนาดของไฟล์ได้เลย

extract
tar xvzf abc.tgz

$ sudo update-java-alternatives -s java-6-sun
$ JAVA_HOME="/usr/lib/jvm/java-6-sun"
$ export JAVA_HOME


Change console language in Debian
==================================
enter 'sudo dpkg-reconfigure locales' to set the default locale for the system environment


force check disk linux on the next reboot
==========================
sudo touch /forcefsck

No comments:

Post a Comment