Penguin

Differences between version 14 and revision by previous author of NewUserTips.

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 14 Last edited on Monday, November 13, 2006 11:43:05 am by IanMcDonald Revert
Older page: version 11 Last edited on Thursday, November 3, 2005 11:40:18 am by JohnMcPherson Revert
@@ -3,17 +3,18 @@
 * Global system configuration files are in the <tt>/etc</tt> directory. 
  
 * Under Debian-based distributions (such as Debian Sarge, Ubuntu, etc): 
 ** Install [Deb] Packages using <tt>dpkg -i filename</tt>. See dpkg(8). 
-** To search for packages available on your distribution, use <tt>aptitude search name<tt>  
-** To install a package, and any other packages it depends on, use <tt>aptitude install name<tt> 
+** To search for packages available on your distribution, use <tt>aptitude search name</ tt>  
+** To install a package, and any other packages it depends on, use <tt>aptitude install name</ tt> 
 ** Note that names are case insensitive, and contain no spaces. Try doing a substring search if you can't find it at first. Debian has over 15000 packages, so there is a good chance it already has what you want. 
  
 * Under RedHat-based distributions: 
 ** Install [RPM] [Package]s using <tt>rpm -Uvh filename</tt>. See rpm(8). 
 ** RedHat based systems now offer better PackageManagementTools such as AptForRpm or [Yum]. Use them instead of manually finding .rpms and installing them 
  
 * Use <tt>tar xzvf filename</tt> to decompress a <tt>.tar.gz</tt> or <tt>.tgz</tt> file, otherwise known as a TarBall. See tar(1) 
+* Use <tt>tar xjvf filename</tt> to decompress a <tt>.tar.bz2</tt> also known as a TarBall. See tar(1)  
  
 * Don't get involved in emacs(1) vs. vi(1) arguments. Use nano(1), pico(1), joe(1), or jed(1) for your initial editing needs. Once you have gotten a little more comfortable with the system, however, be sure to revisit emacs(1) and vi(1) as they offer ''tons'' of power you will never get with the simple minded editors. For the latter, [Vim] is the suggested clone, which comes with a <tt>vimtutor</tt> program that should get your over the initial hurdles quickly. ''Does any equivalent for emacs(1) exist?'' 
  
 * The cp(1) command copies files. The <tt>-a</tt> switch is for copying directories. 
@@ -50,9 +51,155 @@
 * Learn how to use redirection ("<tt><</tt>", "<tt>></tt>") and pipes ("<tt>|</tt>") in the [Shell]. See bash(1) 
  
 * Your initial WindowManager settings are (generally) stored in the <tt>.xinitrc</tt> or <tt>.xsession</tt> file in your home. 
 ** Note that this isn't so relevant any more with GNOME and KDE 
+  
+!!Handy Ubuntu Tips  
+  
+!Write a bash script.  
+Open up your favourite text editor and add this line to the top:  
+*~#~!/bin/bash  
+Now add your bash commands and at end of each line add a ";"  
+Save you file and make sure you chmod to give execute permissions.  
+  
+!Extract zips that are in multiple parts.  
+*unzip -d destdir/ \~*.zip  
+  
+REMEMBER : The '\' is the escape character. Without it, our command would look like:  
+unzip -d destdir/ 1.zip, 2.zip, 3.zip which is bad because after the first zip argument, the following stuff is read as list arguments. With \~*.zip bash doesn't interpret the ~* but unzip does.  
+  
+!Extract rars that are in multiple parts (Using Rar Linux) (eg: .rar,.ro1,r02...)  
+*unrar name.rar destdir/  
+Note: We only need to supply the file with the ".rar" extension. Rar is smart and detects the other files.  
+  
+!Cool tools to play around with  
+*cal  
+Typing this command will display a calendar with the date highlighted.  
+*date  
+Will display the date and time in terminal.  
+*dmesg  
+Displays log of messages printed to the screen during the boot process  
+  
+!Where on Earth is the rename command?  
+We use the "mv" command when renaming instead.  
+*mv dog cat  
+This will rename the file "dog" to "cat".  
+  
+!You can copy/move/list multiple things at a time! Just separate files/expressions with a space.  
+*ls -l *.txt *.letter  
+*cp *.jpg *.bmp ~~/pics/  
+  
+!How to Stop listing dir contents when using glob expressions with ls.  
+Use the -d switch to list just the directories, and not the contents of each matching directory.  
+  
+!Change Password  
+Simply type "passwd". You will be prompted for the current password and then asked to type in a new password.  
+  
+!Jump quickly between words in terminal  
+*Alt-f - Move forward one word.  
+*Alt-b - Move backward one word.  
+  
+!Print to screen first/last few lines of a file.  
+*head -n 20 test.txt  
+Will print to the screen the first 20 lines in test.txt  
+*tail -n 5 test.txt  
+Will print to the screen the last 5 lines in test.txt  
+  
+!Print a Message To The Terminal  
+*echo Damn you rock Staz  
+Note : Make sure to type the above exactly as it is written.  
+*echo $PATH  
+Slightly more useful!  
+  
+!Display a long file to screen  
+*more test.txt  
+Will print the first page of test.txt to the screen, and you can use arrow keys to navigate further.  
+*less test.txt  
+A more advanced version of more. (Can do Searches etc).  
+  
+!Search command History  
+*Alt-r  
+Now Start typing part of the command any matches will be displayed as you type and press enter to use them.  
+  
+!What type of file is that??  
+*file <filename>  
+Will return the file type.  
+  
+!Reload fstab file  
+*sudo mount -a  
+This mounts everything in your fstab file.  
+  
+!How much disk space is the contents of this directory using?  
+  
+1)All Folders/Subfolders  
+*du -h  
+2)The current directory  
+*du -sh  
+3)All folders excluding subfolders.  
+*du --max-depth=1 -h  
+4)All folders beginning with the letter P  
+*du -sh P*  
+  
+!Mount Samba Shares  
+We need to get the smbfs and smbclient packages.  
+* sudo aptitude install smbfs  
+* sudo aptitude install smbclient  
+  
+First lets get a list of the available shares on a particular machine.  
+*smbclient -L <IP/HOST>  
+  
+Now create a folder in /media/ that will be the mount point for your samba share.  
+There are two ways of mounting:  
+1.  
+*sudo smbmount //<IP/Hostname>/smbshare /media/mounthere/ -o username=YYYY,password=YYYY,dmask=XXX,fmask=XXX  
+2.  
+*sudo mount -t smbfs //<IP/Hostname>/smbshare /media/mounthere/ -o username=YYYY,password=YYYY,dmask=XXX,fmask=XXX  
+  
+dmask = directory umask  
+fmask = file umask  
+  
+Now to unmount:  
+*sudo umount/smbumount /media/diryoumountedto/  
+  
+!Add a smb share to fstab that is automatically mounted on boot  
+*sudo /etc/fstab  
+Add this line:  
+//HOST/share/ /mount/point/ smbfs auto,username=xxxxx,password=xxxxx,uid=xxxx  
+This website is really good:  
+http://doc.gwos.org/index.php/HowToMountsmbfsSharesPermanently  
+  
+!Mount all smb shares listed in fstab  
+*sudo mount -at smbfs  
+  
+!Unmount all smb shares listed in fstab  
+*sudo mount -at smbfs  
+  
+!List NTFS Mounted Drives  
+* sudo mount -t ntfs  
+If you want to view mounted fat32 drives simply replace "ntfs" with "vfat"  
+  
+!How much memory is free?  
+* free -m  
+Will tell you how much free memory is available in megabytes.  
+*free -s 60  
+Will tell you how much free memory is available every 10 seconds.  
+  
+!List all your drives  
+* sudo fdisk -l  
+NOTE : Don't forget the "sudo" or else you may not see anything listed.  
+Blocks can be read to mean "Kilobytes"  
+  
+!List Drives/Capacity/Free Space  
+*df -B M  
+The -B switch refers to Block Size. The M means it will be displayed in Megabytes.  
+But if you prefer use K for kilobytes, G for gigabytes etc..  
+  
+df(1) doesn't require root privileges to work. Also "df -h" will select the right units for you. Many programs that support outputting units will support "-h" for "human readable". The other useful command here is du(1).  
+  
+!Install an app from .rpm  
+First you need Alien:  
+sudo aptitude install al  
  
 See also AdvancedUserTips 
  
 ---- 
 CategoryBeginners