Your Ad Here

Monday, September 7, 2009

Debian / Ubuntu Cheat-Sheet

           lists typical commands that are commonly used day-to-day in Ubuntu, along with popular command options. It’s only a brief list, and emphasis is placed on file manipulation commands.
Useful day‐to‐day commands.

Command Description

ls List files and folders.
Typical example: ls ‐l

‐l : Long listing (show permissions, ownerships etc.)
‐a : Show all files, including hidden files
‐h : Show KB, MB etc., rather than bytes

cd Change folder
Type cd .. to change to parent folder.
Typical example: cd Documents

cp Copy file or folder
first specify file (and path if necessary),then specify destination.Typical example: 
cp myfile.doc Desktop/
‐r : Copy folders too, including contents (otherwise
folders will be ignored)

mv Move file or folder
can also be used to rename files/folders if a new destination isn’t specified. Note that, unlike cp, it is not necessary to specify the ‐r option in order to move folders.

Typical example: (moving): mv myfile.doc Desktop/
Typical example: (renaming): mv old.doc new.doc

rm Delete file(s) or folder(s)
multiple files/folders can be specified.

Typical example: rm –rf myfolder

‐r : Delete folder; must be used if a folder is to be deleted
‐f : Force deletion; don’t prompt user for confirmation
when deleting (useful when deleting lots of folders, but must be used with care)
ln Create a link to a file (similar to a shortcut under Windows)
first specify the file (including path if necessary), and then the location where the link should be created. A different filename may be specified for the new link.

Typical example: ln –s myfile.doc ~/Desktop/

‐s : Create symbolic link, rather than hard link. In nearly all situations, a symbolic link is preferable, making this practically a prerequisite command option less Open specified plain text file in a viewer (use cursor keys to scroll; hit Q to quit). Useful for viewing configuration files.

Typical example: less myfile.txt

df Show amount of free disk space on all attached filesystems.

Typical example: df –h
‐h : Show KB, MB, GB etc. rather than bytes

free Show amount of free memory.

Typical example: free –mt
‐m : Show output in megabytes, rather than kilobytes
‐g : Show output in gigabytes
‐t : Show totals column

grep Search through specified file for a word or phrase. First,specify the phrase, and then the file to be searched through.

Typical example: grep –i wireless myfile.txt

‐i : Ignore upper/lowercase when searching

man View the manual (man) page for specified command. A man page is built-in technical documentation—see Appendix B.

Typical example: man ls

nano Simple text editor that’s ideal for creating, editing or viewing files (particularly configuration files); hit Ctrl+J to re-justify current line should you create a line-break during editing.

Typical example: sudo nano /etc/fstab
umount Unmount attached storage device. Not a typo! The command is umount and not unmount. Needs root powers. Specify the mount point.

Typical example: sudo umount /media/cdrom

locate Find specified file
relies on a background database that is periodically and automatically updated. The database can be manually updated by typing the sudo updatedb command.

Typical example: locate filename.doc
‐i : Ignore upper/lowercase when searching

0 komentar:

Post a Comment


My Room Temperature

My Pressure

My Humidity