Archive for January 19, 2013

Basic Linux Commands

Posted: January 19, 2013 in Linux Terminal
Tags: , ,

If you are a new user, you must try these commands. And believe me Working with Terminal is simply interesting.

mkdir – make directories




Create the DIRECTORY(ies), if they do not already exist.

 Mandatory arguments to long options are mandatory for short options too.

 -m, mode=MODE  set permission mode (as in chmod), not rwxrwxrwx – umask

 -p, parents  no error if existing, make parent directories as needed

 -v, verbose  print a message for each created directory

 -help display this help and exit

 -version output version information and exit

cd – change directories

Use cd to change directories. Type cd followed by the name of a directory to access that directory.Keep in mind that you are always in a directory and can navigate to directories hierarchically above or below.

mv- change the name of a directory

Type mv followed by the current name of a directory and the new name of the directory.

 Ex: mv testdir newnamedir

pwd – print working directory

will show you the full path to the directory you are currently in. This is very handy to use, especially when performing some of the other commands on this page

 rmdir – Remove an existing directory

 rm -r

Removes directories and files within the directories recursively.

chown – change file owner and group




chown [OPTION] –reference=RFILE FILE


Change the owner and/or group of each FILE to OWNER and/or GROUP. With –reference, change the owner and group of each FILE to those of RFILE.

 -c, changes like verbose but report only when a change is made

 -dereference affect the referent of each symbolic link, rather than the symbolic link itself

 -h, no-dereference affect each symbolic link instead of any referenced file (useful only on systems that can         change the ownership of a symlink)


  change the owner and/or group of each file only if its current owner and/or group match those specified here.  Either  may  be  omitted,  in which case a match is not required for the omitted attribute.

-no-preserve-root do not treat `/’ specially (the default)

-preserve-root fail to operate recursively on `/’

-f, -silent, -quiet  suppress most error messages

-reference=RFILE use RFILE’s owner and group rather than the specifying OWNER:GROUP values

-R, -recursive operate on files and directories recursively

-v, -verbose output a diagnostic for every file processed

The  following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, only the final one  takes effect.

-H     if a command line argument is a symbolic link to a directory, traverse it

-L     traverse every symbolic link to a directory encountered

-P     do not traverse any symbolic links (default)

chmod – change file access permissions


chmod [-r] permissions filenames

 r  Change the permission on files that are in the subdirectories of the directory that you are currently in.        permission  Specifies the rights that are being granted. Below is the different rights that you can grant in an alpha  numeric format.filenames  File or directory that you are associating the rights with 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

ls – Short listing of directory contents

-a        list hidden files

-d        list the name of the current directory

-F        show directories with a trailing ‘/’

            executable files with a trailing ‘*’

-g        show group ownership of file in long listing

-i        print the inode number of each file

-l        long listing giving details about files  and directories

-R        list all subdirectories encountered

-t        sort by time modified instead of name

cp – Copy files

cp  myfile yourfile

Copy the files “myfile” to the file “yourfile” in the current working directory. This command will create the file “yourfile” if it doesn’t exist. It will normally overwrite it without warning if it exists.

cp -i myfile yourfile

With the “-i” option, if the file “yourfile” exists, you will be prompted before it is overwritten.

cp -i /data/myfile

Copy the file “/data/myfile” to the current working directory and name it “myfile”. Prompt before overwriting the  file.

cp -dpr srcdir destdir

Copy all files from the directory “srcdir” to the directory “destdir” preserving links (-poption), file attributes (-p option), and copy recursively (-r option). With these options, a directory and all it contents can be copied to another dir

ln – Creates a symbolic link to a file.

ln -s test symlink

Creates a symbolic link named symlink that points to the file test Typing “ls -i test symlink” will show the two files are different with different inodes. Typing “ls -l test symlink” will show that symlink points to the file test.

locate A fast database driven file locator.

slocate -u

This command builds the slocate database. It will take several minutes to complete this command.This command must be used before searching for files, however cron runs this command periodically  on most systems.locate whereis Lists all files whose names contain the string “whereis”. directory.

more – Allows file contents or piped output to be sent to the screen one page at a time

less – Opposite of the more command

cat Sends file contents to standard output. This is a way to list the contents of short files to the screen. It works well with piping.

whereis Report all known instances of a command

wc – Print byte, word, and line counts


bg jobs Places the current job (or, by using the alternative form, the specified jobs) in the background, suspending its execution so that a new user prompt appears immediately. Use the jobs command to discover the identities of background jobs.

cal month year Prints a calendar for the specified month of the specified year.

cat files Prints the contents of the specified files.

clear Clears the terminal screen.

cmp file1 file2 Compares two files, reporting all discrepancies. Similar to the diff command, though the output format differs.

diff file1 file2 Compares two files, reporting all discrepancies. Similar to the cmp command, though the output format differs.

dmesg Prints the messages resulting from the most recent system boot.


fg jobs Brings the current job (or the specified jobs) to the foreground.

file files Determines and prints a description of the type of each specified file.

find path -name pattern -print

Searches the specified path for files with names matching the specified pattern (usually enclosed in single quotes) and prints their names. The find command has many other arguments and functions; see the online documentation.

finger users – Prints descriptions of the specified users.

free  – Displays the amount of used and free system memory.

ftp hostname

Opens an FTP connection to the specified host, allowing files to be transferred. The FTP program provides subcommands for accomplishing file transfers; see the online documentation.

head files Prints the first several lines of each specified file.

ispell files Checks the spelling of the contents of the specified files.

kill process_ids

kill – signal process_ids

kill -l

Kills the specified processes, sends the specified processes the specified signal (given as a number or name), or prints a list of available signals.

killall program

killall – signal program

Kills all processes that are instances of the specified program or sends the specified signal to all processes that are instances of the specified program.

mail Launches a simple mail client that permits sending and receiving email messages.

man title

man section title – Prints the specified man page.

ping host Sends an echo request via TCP/IP to the specified host. A response confirms that the host is operational.

reboot Reboots the system (requires root privileges).

shutdown minutes

shutdown -r minutes

Shuts down the system after the specified number of minutes elapses (requires root privileges). The -r option causes the system to be rebooted once it has shut down.

sleep time Causes the command interpreter to pause for the specified number of seconds.

sort files Sorts the specified files. The command has many useful arguments; see the online documentation.

split file Splits a file into several smaller files. The command has many arguments; see the online documentation

sync Completes all pending input/output operations (requires root privileges).

telnet host Opens a login session on the specified host.

top Prints a display of system processes that’s continually updated until the user presses the q key.

traceroute host Uses echo requests to determine and print a network path to the host.

uptime Prints the system uptime.

w Prints the current system users.

wall Prints a message to each user except those who’ve disabled message reception. Type Ctrl-D to end the message.


The VIDEO was Uploaded by Gotbletu – Linux Tutorials
Requires/ What uploader used:
commands for vlc: Alt+F2 type
to pass to alsa:
vlc alsa://plughw:0,0
if u need for pulse:
vlc alsa://pulse
To restart alsa or pulseaudio, close other apps like browsers, music and video players 1st
For Alsa:
$ sudo /sbin/alsa force-reload
For Pulse
$ killall pulseaudio && pulseaudio

The steps below are general Ethernet Category 5 (commonly known as Cat 5) cable construction guidelines. For our example, we will be making a Category 5e patch cable, but the same general method will work for making any category of network cables.

  1. Unroll the required length of network cable and add a little extra wire, just in case. If a boot is to be fitted, do so before stripping away the sleeve and ensure the boot faces the correct way.
  2. Carefully remove the outer jacket of the cable.

    Carefully remove the outer jacket of the cable. Be careful when stripping the jacket as to not nick or cut the internal wiring. One good way to do this is to cut lengthwise with snips or a knife along the side of the cable, away from yourself, about an inch toward the open end. This reduces the risk of nicking the wires’ insulation. Locate the string inside with the wires, or if no string is found, use the wires themselves to unzip the sheath of the cable by holding the sheath in one hand and pulling sideways with the string or wire. Cut away the unzipped sheath and cut the twisted pairs about 1 1/4″ (30 mm). You will notice 8 wires twisted in 4 pairs. Each pair will have one wire of a certain color and another wire that is white with a colored stripe matching its partner (this wire is called a tracer).

  3. Inspect the newly revealed wires for any cuts or scrapes that expose the copper wire inside.

    Inspect the newly revealed wires for any cuts or scrapes that expose the copper wire inside. If you have breached the protective sheath of any wire, you will need to cut the entire segment of wires off and start over at step one. Exposed copper wire will lead to cross-talk, poor performance or no connectivity at all. It is important that the jacket for all network cables remains intact.

  4. Untwist the pairs so they will lay flat between your fingers.

    Untwist the pairs so they will lay flat between your fingers. The white piece of thread can be cut off even with the jacket and disposed (see Warnings). For easier handling, cut the wires so that they are 3/4″ (19 mm) long from the base of the jacket and even in length.

  5. Arrange the wires based on the wiring specifications you are following.

    Arrange the wires based on the wiring specifications you are following. There are two methods set by the TIA, 568A and 568B. Which one you use will depend on what is being connected. A straight-through cable is used to connect two different-layer devices (e.g. a hub and a PC). Two like devices normally require a cross-over cable. The difference between the two is that a straight-through cable has both ends wired identically with 568B, while a cross-over cable has one end wired 568A and the other end wired 568B.  For our demonstration in the following steps, we will use 568B, but the instructions can easily be adapted to 568A.

    • 568B – Put the wires in the following order, from left to right:
      • white orange
      • orange
      • white green
      • blue
      • white blue
      • green
      • white brown
      • brown
    • 568A – from left to right:
      • white/green
      • green
      • white/orange
      • blue
      • white/blue
      • orange
      • white/brown
      • brown
  6. You can also use the mnemonic 1-2-3-6/3-6-1-2 to remember which wires are switched.
  7. Press all the wires flat and parallel between your thumb and forefinger. Verify the colors have remained in the correct order. Cut the top of the wires even with one another so that they are 1/2″ (12.5 mm) long from the base of the jacket, as the jacket needs to go into the 8P8C connector by about 1/8″, meaning that you only have a 1/2″ of room for the individual cables. Leaving more than 1/2″ untwisted can jeopardize connectivity and quality. Ensure that the cut leaves the wires even and clean; failure to do so may cause the wire not to make contact inside the jack and could lead to wrongly guided cores inside the plug.
  8. Keep the wires flat and in order as you push them into the RJ-45 plug with the flat surface of the plug on top.

    Keep the wires flat and in order as you push them into the RJ-45 plug with the flat surface of the plug on top. The white/orange wire should be on the left if you’re looking down at the jack. You can tell if all the wires made it into the jack and maintain their positions by looking head-on at the plug. You should be able to see a wire located in each hole, as seen at the bottom right. You may have to use a little effort to push the pairs firmly into the plug. The cabling jacket should also enter the rear of the jack about 1/4″ (6 mm) to help secure the cable once the plug is crimped. You may need to stretch the sleeve to the proper length. Verify that the sequence is still correct before crimping.

  9. Place the wired plug into the crimping tool.

    Place the wired plug into the crimping tool. Give the handle a firm squeeze. You should hear a ratcheting noise as you continue. Once you have completed the crimp, the handle will reset to the open position. To ensure all pins are set, some prefer to double-crimp by repeating this step.

  10. Repeat all of the above steps with the other end of the cable. The way you wire the other end (568A or 568B) will depend on whether you’re making a straight-through, rollover, or cross-over cable (see Tips).
  11. Test the cable to ensure that it will function in the field.

    Test the cable to ensure that it will function in the field.
    Mis-wired and incomplete network cables could lead to headaches down the road. In addition, with power-over-Ethernet (PoE) making its way into the market place, crossed wire pairs could lead to physical damage of computers or phone system equipment, making it even more crucial that the pairs are in the correct order. A simple cable tester can quickly verify that information for you. Should you not have a network cable tester on hand, simply test connectivity pin to pin.
    [Or Check directly by inserting into your Router and PC]

    • CAT5 and CAT5e are very similar cables, however CAT5e offers better quality especially on longer runs. If making a longer run, CAT5e is recommended, however CAT5 is still an option for small patch cables.
    • A key point to remember in making Ethernet patch cords is that the “twists” in the individual pairs should remain entwined as long as possible until they reach the RJ-45 plug termination. The twisting of the pairs in the network cable is what helps to ensure good connectivity and keeps cross-talk interference to a minimum. Do not untwist the wires any more than you need to.
    • A good idea on the long runs, especially those that you need to hang or snake around, is to crimp and test the cable before you run the cable. This is recommended especially to anyone who is first starting out crimping their own cables, as it ensures you are crimping the correct pin order now, rather than trying to trouble shoot later.
    • Always keep a box of Network Cable resting on one of the four ‘end’ surfaces, never on one of its two sides. This prevents loops falling across each other inside the box causing binding and knots.
    • Fire Codes require a special type of cover over the wires if the cabling is to be installed in ceilings or other areas that are exposed to the building ventilation system. This is usually referred to as plenum-grade cable or simply “plenum cable”, and does not release toxic fumes when burned. Plenum cabling is more costly, perhaps double that of ordinary cable, so only use where necessary. Riser cable is similar to plenum, but is for use in walls or wiring closets to connect floors. Riser may not replace plenum cable so be aware of what area you are laying your cable. If in doubt, use plenum as it has the strictest and safest ratings.
    • RJ-45 is the common term most individuals use for the connectors present in CAT5 cabling. The correct name of the connector is simply 8P8C, where as RJ-45 is the name of a very similar looking defunct connector used in telecommunication. Most people will understand RJ-45 as 8P8C, but be careful when purchasing out of a catalog or online where you can’t visibly determine which you are purchasing.
    • Unless you need to do a large amount of cabling work, it may be less frustrating and, due to the cost of tools, less expensive to purchase ready-made cables.
    • A cat5 cable can not exceed 100 meters, or 328 feet. It probably shouldn’t go beyond 300 feet.
    • The ripcords, if present, are usually quite strong, so do not attempt to break them. Cut them.
    • Be aware of any shielding your cable may have. The most common type of cable is UTP (Unshielded Twisted Pair), but a number of shielding/foiling options exist for added protection against EMI. Be aware of what you are purchasing and what you need. In most environments, UTP will be fine.
    Things You’ll Need
    • Crimper – This is the most essential tool and critical to the cable making process. If you don’t have a quality crimper, then your cable connections will be bad. Inferior crimpers will make it difficult and/or nearly impossible to achieve a tight connection between the wires. Many better quality crimpers also have a ratcheting controlled closure for precise crimping. Crimpers with a plastic body will be more likely to develop a sloppy hip joint and give consistently poor cramps; a metal crimper is much preferred, and very common.
    • Tester (Optional) – Although not necessary for making cables, having a good cable tester can prevent and solve cable wiring configuration and installation problems. Most testers consist of two boxes (transmitter and receiver) you plug your patch cable into. The transmitter box tests the cable by sending test pulses down each individual wire, lighting up LED lights on the receiver box. Most testers will show you a result of the pass. Why do you want to test cables? Even if they are slightly damaged, network cables will work, but cause packet loss and data corruption to your hardware.
    • RJ45 Connectors – Ensure your RJ45 connectors are designed for the type of cable you are using (solid/stranded), as they have different types of teeth for piercing between multiple strands or around a solid single strand. Note: if you ask in an electrical trades store for RJ45 connectors, you may be asked whether you want “solid”, “stranded” or “flat”. The “flat” choice relates to the old flat “silver satin” cables used in 10Base-T, and should not be used in new Ethernet deployments.
    • Bulk Cable – Bulk cable can be found at computer stores, electrical stores, and home centers. You can obtain Category 5, Category 5e, and Category 6 cable, depending on your needs. For lengths shorter than 50′ use a stranded/braided cable. For lengths greater than 50′ use a solid cable.
      • There are two types of wire (solid or stranded) and which one you choose should be based on where and how the patch cable is to be used. See warning above about PLENUM cable. Stranded wire is best for a workstation patch as it can tolerate flexing without cracking the conductors; however, the trade off is that they’re more susceptible to moisture penetration.[2] Solid is best used in a wire closet or for a patch that will be moved very infrequently, as the conductor tends to crack if bent and/or flexed. Cracked conductor leads to “reflections” which make for chatter on the LAN connection, hampering speed and reliability.
    • Boots (optional but preferred). It saves the cable in the long run and improves the looks. A boot is a molded piece of plastic that protects the connector from snagging, if it is pulled through the wall or conduit. It also provides strain relief on the cable, making it harder for the connector to be pulled off.
    • Straight edge wire cutter. You may find serrated snips work very nicely. Use something that gives an easy square cut; avoid diagonal pliers for this reason. You will find that many quality crimpers have a straight edge cutter built in.
    • Fish Tape – Fish tape is either a metal or plastic spool of guide wire. Strong enough not to buckle and bend while being pushed around, but flexible enough to be pushed past corners and bends, fish tape is a vital tool for some cable runs. Recommended conditions include: conduit, within walls, along structural beams and girders, in ducting, plenums, and dropped ceilings, or any situation where it’s not physically possible to drag the cable along with you.

    [ Also, Look for:  What Is The Difference Between Cat 5, Cat 5e, and Cat 6 Cable?]