Linux
Config your browser to access other ports
Browse websites on non-standard ports like 79 with Firefox
If you try to browse http://www.yourhomepage.com:79 Firefox will cancel this request for your protection.
It does that by default whenever you use a port other than port 80 - the default website port.
Solution:
1. Open Firefox
2. Type about:config in the browser address field ..
List .log files open by a pid
List .log files open by a pid or by a particular process
lsof -p 1234 | grep -E "\.log$" | awk '{print $NF}'
Uses lsof to display the full path of ".log" files opened by a specified PID.
You can find what a process have done. By using the process id you ..
List all the installed kernals
The below command will print the list of installed kernel by searching the rpm.
rpm -qf /lib/modules/*
The below command will list the kernel module using ls command
ls -1 /lib/modules
..
Gedit Editor use japan character encodings
Gedit dosen't support Japanese major character encodings - EUC-JP,
Shift-JIS and ISO-2022-JP, so Japanese users often face garbled
characters on gedit. If a users select "Japanese" on installer, it's
good to make gedit detect these character encodings to ensure out-of-
the-box support for Japanese.
With following commands, gedit supports these encodings.
gconftool-2 -s /apps/gedit-2/preferences/encodings/auto_detected --type=list ..
Hardware or Ethernet Address
The below command will help you to get all the mac or Ethernet address
ifconfig | awk '/HWaddr/ { print $NF }'
The ifconfig command is used to get the system IP address and MAC address.
..
Linux set jdk env variable
How to Set JAVA_HOME / PATH variables Under Linux Bash Profile?
Set JAVA_HOME / PATH for single user
Login to your account and open .bash_profile file
$ vi ~/.bash_profile
Set JAVA_HOME as follows using syntax export JAVA_HOME=. If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:
export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
Set PATH as ..
System load average
Normally we use top command to see the system load average, you can also use tload and xload command to monitor the system load.
top -c
tload -s 10
xload
..
Optional commands and runlevel command
Samba can be used to allow connectivity between Linux and Windows(95,98,NT,2000).
Samba can be used to share printers, share directories, connect to an NT domain, and many other useful features.
Runlevel ScriptOptional CommandStart Samba/etc/rc.d/init.d/samba start /usr/sbin/smbd -D and /usr/sbin/nmbd -DStop Samba/etc/rc.d/init.d/samba stopkillall -TERM smbd and killall -TERM nmbdRestart Samba/etc/rc.d/init.d/samba restartkillall -HUP smbd ..
Find free disk space
Check free Space
df -h
h - human readable format, specifies disk space in MB or GB
The above command is used to specify how much free space is available in your system.
..
Backup thunderbird email account
Go to mails folder using the following path,
/home/.thunderbird/xxxxxxxx.default/mails.
Mails folder contains all the mails you have received and the sub folders you have created under your account.
Copy the mails folder and save it in CD or DVD.
Whenever you need to reinstall thunderbird or reinstall OS, backup thunderbird ..
Function to create and change directory
How often do you make a directory (or series of directories) and then change into it to do whatever? 99% of the time that is what I do.
Command to create a directory and change to it
# md () { mkdir -p "$@" && cd "$@"; }
This BASH function 'md' ..
Finding all files with SUID and SGID
Remove everything except that file
# find . ! -name <FILENAME> -delete
it will remove everything except the file names matching you can use also use wildcards
Finding all files on local file system with SUID and SGID set
find / \( -local -o -prune \) \( -perm -4000 -o -perm -2000 ..
How to delete empty directories
Find and delete empty directory, start in current working directory.
# find . -type d -empty -delete
The above command will search for the empty directory from the current directory and will delete all the empty directories. Be careful while you play in server.
..
Simulate typing
You can simulate on-screen typing just like in the movies
echo "simulate typing" | pv -qL 10
This will output the characters at 10 per second.
Very useful command for simulating typing.
..
Refer to command line n
Run the last command as root (sudo !-n, n...1,2,3...)
# sudo !-1
Run the previous command as root
! Start a history substitution, except when followed by a blank, newline, = or (.
!n Refer to command line n.
!-n Refer to the current command line minus n.
!! Refer to the ..