September 29

Linux: lsusb – Linux USB Utilities

NAME

       lsusb - list USB devices

SYNOPSIS

       lsusb [ options ]

DESCRIPTION

       lsusb  is  a  utility for displaying information about USB buses in the
       system and the devices connected to them.

       To make use of all the features of this program, you  need  to  have  a
       Linux  kernel  which  supports the /proc/bus/usb interface (e.g., Linux
       kernel 2.3.15 or newer).

OPTIONS

       -v, --verbose
              Tells lsusb to be verbose and display detailed information about
              the  devices shown.  This includes configuration descriptors for
              the device’s current speed.  Class descriptors  will  be  shown,
              when  available,  for  USB  device classes including hub, audio,
              HID, communications, and chipcard.

       -s [[bus]:][devnum]
              Show only devices in specified bus and/or devnum.  Both ID’s are
              given in hexadecimal and may be omitted.

       -d [vendor]:[product]
              Show  only  devices  with  the  specified vendor and product ID.
              Both ID’s are given in hexadecimal.

       -D device
              Do not scan the /proc/bus/usb directory,  instead  display  only
              information  about  the  device whose device file is given.  The
              device file  should  be  something  like  /proc/bus/usb/001/001.
              This option displays detailed information like the v option; you
              must be root to do this.

       -t     Tells lsusb to dump the physical USB device hierarchy as a tree.

       -V, --version
              Print   version  information  on standard output, then exit suc-
              cessfully.

DIAGNOSTICS

       cannot open /proc/bus/usb/nnn/nnn, Permission denied (13)
              To get detailed  information,  lsusb  must  open  the  files  in
              /proc/bus/usb  in read-write mode.  You must be root in order to
              do this.

RETURN VALUE

       If the specified device is not found, a non-zero exit code is returned.

FILES

       /usr/share/usb.ids
              A  list  of all known USB ID’s (vendors, products, classes, sub-
              classes and protocols).

       /proc/bus/usb
              An interface to USB devices provided by  the  post-2.3.15  Linux
              kernels.  Contains  per-bus subdirectories with per-device files
              and a devices file displaying some of the descriptors  for  each
              USB  device.   This  interface is also support by some 2.2 Linux
              kernels.

SEE ALSO

       lspci(8)
Category: Linux | Comments Off on Linux: lsusb – Linux USB Utilities
September 28

Utilities: CHMOD



Linux: CHMOD

Enter the permissions as needed for your files to find the numerical value to chmod your file.

Check the desired boxes or directly enter a valid
numeric number to see its value in other formats.

Permissions:

  Owner Group Other
Read
Write
Execute

Typical Chmod permissions values:

664 or -rw-r–r–   web pages and images viewed by surfers.
666 or -rw-rw-rw-  – log files or pages that are written to.
755 or -rwxr-xr-x  – perl scripts to make them executable.
755 or -rwxr-xr-x  – directories are usually given this value.
777 or -rwxrwxrwx  – for files that are written to by all.
777 or -rwxrwxrwx  – directories that have files created inside them.

What is Owner, Group and Other?

Owner – the user/owner of a file or directory.
Group – individuals who are in the same group.
Other – users that are not the owner or part of the group.


By using this calculator you agree that we are not liable for anything that may happen by your use.
__________________________________________________________________________

More about chmod

Changes the permission of a file.

Syntax

chmod [OPTION]… MODE[,MODE]… FILE…
chmod [OPTION]… OCTAL-MODE FILE…
chmod [OPTION]… –reference=RFILE FILE…
-c, –changes like verbose but report only when a change is made
–no-preserve-root do not treat `/’ specially (the default)
–preserve-root fail to operate recursively on `/’
-f, –silent, –quiet suppress most error messages
-v, verbose output a diagnostic for every file processed
–reference=RFILE use RFILE’s mode instead of MODE values
-R, –recursive change files and directories recursively
–help display this help and exit
–version output version information and exit

Permissions
u – User who owns the file.
g – Group that owns the file.
o – Other.
a – All.
r – Read the file.
w – Write or edit the file.
x – Execute or run the file as a program.

Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:

400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody

Examples

The above numeric permissions can be added to set a certain permission, for example, a common HTML file on a Unix server to be only viewed over the Internet would be:

chmod 644 file.htm

This gives the file read/write by the owner and only read by everyone else (-rw-r–r–).

Files such as scripts that need to be executed need more permissions. Below is another example of a common permission given to scripts.

chmod 755 file.cgi

This would be the following 400+040+004+200+100+010+001 = 755 where you are giving all the rights except the capability for anyone to write to the file.cgi file(-rwxr-xr-x).

chmod 666 file.txt

Finally, another common CHMOD permission is 666, as shown below, which is read and write by everyone.

Additional information

Below is an example of how a file may be listed when typing ( ls -l ) at the prompt as well as information on how to interpret it.

-rw-rw-r– 1   selene  123   Feb 03 15:36   file.txt

rw rw- r– 1 selene 123 Feb 03 15:36 file.txt
File owner group everyone else links owner size mod date file name

Related commands

Category: Linux, Utilities | Comments Off on Utilities: CHMOD
September 27

Linux: Joining .avi or .mpg files together using mencoder

Program installation:
sudo apt-get install mencoder mplayer

You may want to rename your video files to make life easier.

If you are use to using ” you can go the following:
cat video1.mpg video2.mpg video3.mpeg > video.avi

After they are put together use mencoder to sync the video with the audio:
mencoder -forceidx -oac copy -ovc copy video.mpg -o finalvideo.mpg

An easier method is:

mencoder -oac copy -ovc copy video1.mpg video2.mpg video3.mpeg -o finalvideo.mpg

Category: Linux | Comments Off on Linux: Joining .avi or .mpg files together using mencoder
September 27

Linux: Putting two or more files together using cat

Many people are familiar with the “cat” command.  Most of us use it when dealing with text and logging.
This command can also be use to put multiple video files together.

Example:
cat video1.mpg video2.mpg > finalvideo.mpg

This is best when using video without audio.
If putting two video files together that have audio you will need to sync the video and sound with a program like mencoder.

cat command options:

cat [OPTION] [FILE]…

Description

Concatenate FILE(s), or standard input, to standard output.

-A, –show-all
equivalent to -vET
-b, –number-nonblank
number nonblank output lines
-e
equivalent to -vE
-E, –show-ends
display $ at end of each line
-n, –number
number all output lines
-s, –squeeze-blank
never more than one single blank line
-t
equivalent to -vT
-T, –show-tabs
display TAB characters as ^I
-u
(ignored)
-v, –show-nonprinting
use ^ and M- notation, except for LFD and TAB
–help
display this help and exit
–version
output version information and exit

With no FILE, or when FILE is -, read standard input.

Examples

cat f – g
Output f’s contents, then standard input, then g’s contents.
cat
Copy standard input to standard output.
Category: Linux | Comments Off on Linux: Putting two or more files together using cat
September 26

Linux: How to flush DNS in Ubuntu

Sometimes you need to see the changes that have been made on a DNS server, but these changes are stuck in your workstation DNS cache.

Similar to Windows ipconfig /flushdns you can flush your Linux computers DNS.
You must first install the name service cache daemon (nscd).  This is not usually installed by default.
After the install is complete you can simply restart the nscd as need to clean your DSN cache.

  1. sudo apt-get install nscd
  2. Flush DNS Cache in Ubuntu Using the following command
  3. sudo /etc/init.d/nscd restart
Category: Linux | Comments Off on Linux: How to flush DNS in Ubuntu