Linux
Simple shortcut commands
<Ctrl><Alt><F1>
Switch to the first text terminal. Under Linux you can have several (6 in standard setup) terminals opened at the same time.
<Ctrl><Alt><Fn> (n=1..6)
Switch to the nth text terminal.
tty
Print the name of the terminal in which you are typing this command.
<Ctrl><Alt><F7>
Switch to the first GUI terminal (if X-windows is running on ..
Untar or Decompress files and Folders
How to uncompress or extract the compressed files or zip files?
You can use the below commands to uncompress or decompress the files and folders using the below linux command.
# tar -zxvf filename.tar.gz
(=tape archiver) Untar a tarred and compressed tarball (*.tar.gz or *.tgz) that you downloaded from the Internet.
..
Locate the busy driver
When you are trying to unmount a device drive, but it keep saying that your system or drive is busy.
# lsof +D /mnt/drive-name
This will return the command and process ID of any tasks that is currently accessing the /mnt/drive-name directory.
By finding the Process-ID you can either ..
Free video cutter
Avidemux
Avidemux is a free video editor designed for simple cutting, filtering and encoding tasks. It supports many file types, including AVI, DVD compatible MPEG files, MP4 and ASF, using a variety of codecs. Tasks can be automated using projects, job queue and powerful scripting capabilities. Avidemux is available for Linux, ..
Change color settings in terminal
To view your current setting of your terminal use the below command
# echo $PS1
To Change the current Display
# export PS1="\e[0;34m[\u@\h \W]\$ \e[m"
Here,
\e [Start color scheme
x;ym Color pair to use
\u user
\h host
\W ..
Show the file size
How to find the size of a folder and sub folder in Linux machine
In windows machine you can find the size of a file easily just
Right click the file or folder -> Select properties -> It will show the file size.
In Linux machine you can use du command to ..
Show when you have installed your os
Some time the system admin may want to maintain a record when the filesystem is created and when the operating system is installed. The dumpe2fs will help you to find when the filesystem is created and from tat you can conclude when your operating system was installed?
Fdisk command ..
Linux Video converter
Convert your favourite video to youtube fomat or flv format using ffmpeg command. for this you must have installed ffmpeg in your system.
The syntax to convert a video to flv format
ffmpeg -i Your_video_file -s 320x240 FILE.flv
Example to convert a video to flv format
# ffmpeg -i mike.avi ..
Find information about information about Semaphore and Shared Memory Segments
You can use the ipcs command to get information about Semaphore Arrays, Shared Memory Segments and Message Queues.
# ipcs
The ipcs command will print the semaphore and Inter process communication information ( IPC ) information.
To get IPC information specifically, use
# ipcs -u
Sample Output:
------ Shared Memory Status --------
segments allocated 100
pages ..
Show your locale language
To find the default language configured in your machine use the command locale. The locale command will show the language preference of your system.
# locale | grep LANG=
Sample OutPut:
LANG=en_US.UTF-8
..
Determine tcp port is open or close
nmap command can be used to find the tcp port 80 is open or closed. To find whether the port is open or close use the namp command with the following options.
nmap -p 80 hostname
Example:
nmap -p 80 localhost
For UDP
nmap -sU -p ..
Install wine to use exe
Install Wine to execute exe files in linux machine.
yum install wine
This will install wine and required files.
How to install exe files on linux machine
Just execute the setup.exe file to install the package.
How to use wine command to execute .exe file in linux machine.
- Open Terminal
- Type ..
System resource usage of a pid
Use the below command to find the system resource usage of a particular process id.
pmap -d <<pid>>
Example:
pmap -d 5109
OUTPUT:
00c25000 4 rwx-- 0000000000016000 008:00009 libpthread-2.9.so
00c26000 8 rwx-- 0000000000c26000 000:00000 [ anon ]
00c28000 ..
Kill a particular program
To kill all the httpd or apache process you can use the following command.
# ps ax| awk '/[h]ttpd/{print $1}'| xargs kill -9
The above command will kill all the http process on the server.
To kill all php programs use
# fuser -k /usr/bin php
Which will kill all the php process.
..
Process thread count
To monitor or view the thread count of a certain process on aix or Unix server use the below command.
Syntax to find process thread count
ps -o thcount -p <process id>
Example to find the process count
# ps -o thcount -p 2961
Output:
THCNT
..