Showing posts with label Linux Commands. Show all posts
Showing posts with label Linux Commands. Show all posts

Saturday, January 25, 2014

seinfo Command in Linux

seinfo Command Examples in Linux

Command: seinfo

Command Usage: seinfo allows the user to query the components of a SELinux policy

Syntax: # seinfo [OPTIONS] [EXPRESSION] [POLICY ...]

Example:

1. To get information about a selinux policy

    $ seinfo /etc/selinux/targeted/policy/policy.24

2. To print help info of this command

    $ seinfo -h

3. To  print  stats of a selinux policy

    $ seinfo --stats /etc/selinux/targeted/policy/policy.24

seinfo Command in Linux

Sunday, January 19, 2014

rar Command in Linux

rar Command Examples in Linux

Command: rar

Command Usage: archive files with compression

syntax: $ rar <command> [-<switch 1> -<switch N>] archive [files...]

Examples:

1. To print help and options of this command

    $ rar --help

2. To rar a single file

    $ rar a dmesg.rar /var/log/dmesg

3. To rar multiple files

    $ rar a var-log-account.rar /var/log/account/*

4. To delete a file from a archive file

    $ rar d sample.rar

5. To recover or fix a archive file

    $ rar r sample.rar

6. To update or add files to existing archive file

    $ rar u sample.rar more.pdf

7.  To password protect archive file

    $ rar a -p sample.rar

8. To extract files with full path

    $ rar x sample.rar

9. To lock a particular archive file from extracting it

    $ rar k sample.rar

rar Command in Linux

CP Command in Linux

CP Command Examples in Linux

Command: cp

Command Usage: copy files and directories

syntax: $ cp [options] source destination

Command Examples:

1. To display options and help of cp command

    $ cp --help

2. To copy a file from a source to a destination

    $ cp /home/example.txt  /tmp/example.txt

3. To copy a file from source to destination with a different name

    $ cp /home/test.txt  /tmp/sample.txt

4. To copy a directory from source to destination  recursively

    $ cp -r original  backup

5. To copy multiple files and directories

    $ cp file1.txt file2.txt file3.txt  /tmp

    $ cp  -r dir1/ dir2/ /tmp

6. To preserve the links while copying

    $ cp -d test1.sh  /home/dhana/work/test1.sh

7. To create a hardlink to a file while cp

    $ cp -l sample.txt testdir/

8. To create a soft link to a file instead of copy

    $ cp -s libjavascriptcoregtk-3.0.so.0.13.4  libjavafs.so

9. To preserve attributes of file and directory

    cp -p sample.txt sampledir/

10. To copy only when the SOURCE file is newer than
      the destination file or when the destination file is missing

      $ cp -v -u sample.txt  /home/dhana/sampledir/

11. To copy files in interactive mode

      $ cp -i test.txt  /home/dhana/sampledir/

CP Command in Linux

Sunday, January 12, 2014

lshw command in Linux

lshw command Examples in Linux

Command: lshw

Command Usage: lshw  is  a  small tool to extract detailed information on the hardware configuration of the machine.

Syntax: $ lshw [-format] [-options ...]

Examples:

1. To show the detailed description of hardware

     # lshw

2. To print compact report

     # lshw -short

3. To print details about RAM

     # lshw -class memory

4. To print details about HDD

     # lshw -class disk

5. To print help info of this command

     # lshw --help

6. To print details about processor

     # lshw -class processor

7. To print without sensitive details like serial numbers

     # lshw -sanitize

8. To print numeric IDs of USB, PCI

    # lshw -numeric

lshw command in Linux

Tuesday, January 7, 2014

How to Change Directory in Linux

How to Change Directory in Linux

Linux is one of the most popular operating system which is powering a majority of internet servers. As the internet grows , system administrators who have a good grasp of the Linux operating system are always in high demand in the industry. In this tutorial you can learn how to change the directory in Linux environment .

Command: CD

Command Usage:
  • Which is used to change the current directory. This is equivalent to the CD and CHDIR commands in MS-DOS.
  • To change directories in a Linux environment, use the cd command.
  • The abbreviation of CD is Change Directory 
The cd command allows you to change directories. When you open a terminal, you will be in your home directory. To move around the filesystem, use cd.

Below are some basic examples of how this command can be used to change directories in Linux OS.
  •  To navigate to your desktop directory, use cd ~/Desktop
  •  To navigate into the root directory, use cd /
  •  To navigate to your home directory, use cd
  •  To navigate up one directory level, use cd ..
  •  To navigate to the previous directory (or back), use cd -

When you need to move into multiple directories with single command, you can use a command to the below example for your directory.
cd Documents/Picture

When you need to move back a directory, you can use the below command example in your terminal.
cd...

 Change Directory Command in Linux

Thursday, January 2, 2014

xrandr Commands In Linux

xrandr Commands In Linux

The xrandr command, which is expanded as Xrandr – X Resize, Rotate and Reflection , is useful in the following ways :
  • Specifies the connection to the X server.
  • Specifies which screen.
  • Specifies the screen.
  • Specifies the rotations or reflections possible of the screen.
  • Specifies the current rotations and reflection of the screen.
  • Specifies the server timestamp.
  • Specifies the timestamp when the screen was last (re)configured.
  • Specifies the screen configuration being used.
  • Specifies the array of sizes supported.
  • Specifies the refresh rate in Hz.
Now what do we do with this … something thats really useful ?
$ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 1600 x 1600
VGA connected 1024×768+0+0 (normal left inverted right x axis y axis)
312mm x 234mm
1024×768       85.0*+   84.9     85.0*    75.1     75.0     70.1     60.0
1600×1024      60.0
1280×1024      59.9     60.0
1440×900       60.2
1280×960       60.0
1280×800       60.0
1152×864       75.0
1280×768       60.0
1152×768       54.8
832×624        74.6
800×600        84.9     85.1     72.2     75.0     60.3     56.2
640×480        85.0     84.6     75.0     72.8     75.0     60.0     59.9
720×400        85.0     70.1
640×400        85.1
640×350        85.1
My screen is running at 85 Hz per second refresh rate and I am at a resolution of 1024×768.
My eyes are very important since I work on the computer day in day out(never at nights) and I have been doing this for more than 11 years now.
How?
It is due to UNIX!
I always set very good refresh rates and I set a dark background and pleasing colors.
My eyes never get sore.
If we go to villages in the train, we find that whenever we see paddy fields with lush green color, our heart leaps and a whiff of pleasure courses through our heart.
Green is very pleasing to the eyes. That is the reason it is very important for Mohemmedans.
I always use xterm with green foreground and black backgrounds.
$ xrandr -o left
$ xrandr -o right
$ xrandr -o inverted
$ xrandr -o normal
Try all this. It is great fun!
$ xrandr -s 1024×768
will set the 1024×768 pixels mode. You set the refresh rate with the -r switch.
In my case I can get the 1280×1024 mode, but then the refresh rate is very poor.So I switched back.
For higher modes you get lower refresh rates since there are limitations in the graphics memory of the graphics card.
Of course you guys must be knowing the Alt Ctrl + and Alt Ctrl - keystrokes for switching between modes. And you can kill X by Alt Ctrl Backspace. If you are running a display manager this will only restart X.
Remember xrandr is a X extension. You should have it loaded for all this to work. In general all my tips may necessitate installation of some package.You have to take care of that.
Since there is no universal way to install packages and you cannot install all packages from source I will leave that out. You have to figure out.
If you are using Debian, of course things are very simple. 

xrandr Commands In Linux

Sunday, December 29, 2013

Uptime Command Examples in Linux

Linux Command  Uptime

Today we are going to Uptime time command. This command is very useful for network and system administrators 

Usage Of Uptime Command:

         The Linux uptime command shows since how long a system has been running and how many users are currently logged in and also displays load average for 1,5 and 15 minutes intervals.

Command Syntax :

# uptime


08:16:26 up 22 min,  1 user,  load average: 0.00, 0.03, 0.22

How To Check Uptime Version in Linux

Uptime command don’t have other options other than uptime and version. It gives information only in hours:mins if it less than 1 day.
[atithya@atithya ~]$ uptime -V

procps version 3.2.8

Uptime Command Example in Linux

Wednesday, December 25, 2013

Trace Route Command In Linux

Linux Command Trace Route

Command: traceroute

Command Usage: print the route packets trace to network host

Examples:
1. To find the network path from your localhost to www.wallpaperscollections.in

    $ traceroute 
www.wallpaperscollections.in

2. To disable hostname mapping in traceroute

    $ traceroute 
www.wallpaperscollections.in -n

3. To set the number of seconds to 0.2 seconds wait for
    response to a probe (default is 5.0). non-integer (float point)
    values allowed too

    $ traceroute 
www.wallpaperscollections.in -w 0.2

4. To print help info of this command

    $ traceroute --help

5. To set the number of probes per each hop to 5. default is 3

    $ traceroute 
www.wallpaperscollections.in -q 5

6. To start from the first_ttl hop (instead from 1)

    $ traceroute 
www.wallpaperscollections.in -f 5

Trace Route Command In Linux

Monday, December 23, 2013

Join Linux Command With Examples

Linux Command Join With Examples

Command: join

Command Usage: join lines of two files on a common field

Syntax: $  join [OPTION]... FILE1 FILE2

Examples:

1. To find options and help info of this command

    $ join --help

2.  $ cat > file1.txt
     1 india
     2 uk
     3 us
     4 nepal
     5 australia

     $ cat > file2.txt
     1 newdelhi
     2 london
     3 washington
     4 kathmandu
     5 canberra

     to join file 1 and file 2 which is sorted

     $ join file1.txt file2.txt

     1 india newdelhi
     2 uk london
     3 us washington
     4 nepal kathmandu
     5 australia canberra

     If the input is not sorted lines cannot be joined, a warning message will be given.

3. To ignore cases when comparing file fields

    $ join -i file1.txt file2.txt

4. To verify that input is sorted

    $ join --check-order file1.txt file2.txt

5. To not to check that input is sorted

    $ join --nocheck-order file1.txt file2.txt

6. To print unpairable lines

    $ join -a1 file1.txt file2.txt

7. To print only unpaired lines

    $ join -v1 file1.txt file2.txt

8. To print help info of this command

    $ join --help

Join Linux Command With Examples

Sunday, December 22, 2013

Paste Command Examples in Linux

Linux Paste Command Examples

Command: paste

Command Usage: merge lines of filesCommand Syntax: $ paste [OPTION]... [FILE]...

Examples for Paste Command:

1. To print options and info of this command

    $ paste --help

2. To paste two files f1.txt and f2.txt

    $ cat  f1.txt
    a
    b
    c

    $ cat f2.txt

    1
    2
    3

    $ paste f1.txt f2.txt

    a  1
    b  2
    c  3

 3. To paste two files f1.txt and f2.txt with delimiters -d and
     serial -s

     $ paste -s -d : f1.txt f2.txt

     $ paste -s -d : f1.txt f2.txt

     a:b:c
     1:2:3


Paste Command Examples in Linux

Friday, December 20, 2013

Whatis Command Examples in Linux

Linux Whatis Command Examples

Command: whatis

Command Usage: it displays a single line information about a command

Syntax Of What is Command: $  whatis [option] keyword

Example:

1. To emit debugging messages of ls command

    $ whatis -d ls

2. To print verbose warning messages

    $ whatis -v ps

3. To search only these sections of keyword

    $ whatis -s "1","8" keyword

4. To print the keywords contain wildcards

    $ whatis -w 'bc*'

5. To interpret each keyword as regex

    $ whatis -r '^bc'

    it displays linux commands start from 'bc'

    $ whatis -r 'ee$'

    it displays linux commands ends with 'ee'

6. To disable trimmed output

    $ whatis -l tee

7. To print help info of this command

    $ whatis -h

8. To set search path for manual pages to path

    $ whatis -M /usr/share/man ps


Whatis Command Examples in Linux

Thursday, December 19, 2013

How To find External IP address in Linux

How To find External IP address in Linux

To find your external IP address in Linux Terminal follow the below command then you will get a your external IP Address.

curl ifconfig.me

How To find External IP address in Linux


Tuesday, December 3, 2013

System Management Commands in Linux

Linux System Management Commands

The following commands are mostly we are using in the Linux system , So i am here mentioning the important thing what we are using our daily usage in Linux system management commands.

System Management Commands in Linux

Runtime level management
  1. exit Terminates the shell.
  2. halt Stop the system.
  3. init Process control initialization. (init 3)
  4. logout Log the user off the system.
  5. poweroff Brings the system down.
  6. reboot Reboot the system.
  7. runlevel List the current and previous runlevel.
  8. shutdown If your system has many users, use the command shutdown -h +time ‘<message>`, where time is the time in minutes until the system is halted, and message is a short explanation of why the system is shutting down.                                                               Ex: # shutdown -h +10 'We will install a new disk. System should be back on-line in three hours.‘
  9. passwd Set a user's pass word. (passwd, passwd <username>)
  10. quota Display users' limits and current disk usage. (quota, quota <username>)
  11. quotaoff Turns filesystem quotas off.
  12. quotaon Turns filesystem quotas on.
  13. quotacheck Used to check a filesystem for usage, and update the quota.user file.
  14. edquota Used to edit user or group quotas. (edquota <username>).
  15. su Single user login. (su -)
  16. useradd Create a new user or update default new user information. (useradd –g <group> -s <shell> -c <comment> –d <home directory> <username>
  17. userdel Delete a user account and related files. (userdel <user name>)
  18. usermod Modify a user account.
  19. users Print the user names of users currently logged in.
  20. wall Send a message to everybody's terminal. (wall “text message”)
  21. who Display the users logged in.
  22. whoami Print effective user id.                              
    System Time
  23. cal Calendar. (cal, cal 2005)
  24. date Print or set the system date and time. (date, date MMDDhhmm[[CC]YY][.ss]) 
  25. hwclock Set or read the hardware CMOS clock.
  26. uptime Reports how long the system has been running.

System Management Commands in Linux

Unrar Command Examples in Linux

Today i am going to dicuss with Linux Command called , Unrar Command Examples in Linux

Command: unrar

Command Usage: extract files from rar archives

Syntax
: unrar <command> [-<switch 1> -<switch N>] archive [files...] [path...]

Examples For Unrar Command :

1. To extract file

    $ unrar e sample.rar

2. To list file inside archive without uncompressing

    $ unrar l sample.rar

3. To extract files with full path

    $ unrar x sample.rar

4. To test integrity of archieve

    $ unrar t sample.rar

5. To display options of this command

    $ unrar --help


Unrar Linux Command Examples

Linux Tips and tricks,Online Linux Helpers