Penguin

Differences between version 14 and predecessor to the previous major change of NewUserTips.

Other diffs: Previous Revision, Previous Author, 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 13 Last edited on Friday, September 15, 2006 3:50:19 pm by IanMcDonald Revert
@@ -51,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