Linux Tips & Tricks
From WikiWiki
|
Misc Linux Tips and Tricks This is where I will keep various tips and tricks as reminders for me and pointers for others.
Originally Created: August 23, 2007 by Bruce A. Westbrook |
Contents |
[edit] Network Shares
[edit] How to access network folders without mounting - Gnome GUI
Press 'Alt+F2' (Run Application...) and enter:
smb://[IP_address]/[sharename]
[edit] List Windows shares - command line
List Windows shares:
smbclient -L [IP_address] -U [Windows_username]
[edit] Mount Windows shares - command line
First, you need to install the SMB File System (smbfs) if you haven't already.
sudo apt-get install smbfs
To mount in a Read mode only:
sudo mkdir /mnt/[sharename] sudo mount //[ip_address]/[share] /mnt/[sharename]/ -o username=[myusername],password=[mypassword]
To mount in a Read/Write mode:
sudo mkdir /mnt/[sharename] sudo mount //[ip_address]/[share] /mnt/[sharename]/ -o username=[myusername],password=[mypassword],dmask=777,fmask=777
[edit] Unmount Windows share - command line
sudo umount /mnt/[sharename]
[edit] Restart Xwindows
Restart the Gnome Desktop Manager by pressing
CTRL+ALT+BACKSPACE
on your keyboard.
[edit] Nmap
[edit] Simple ping sweep
nmap -sP [ip_address]
[edit] Scan single IP address
Single IP address nmap scan, no pinging (P0), verbose (v), determine OS (A), do it fast (T4)
nmap -P0 -v -A -T4 [ip_address]
[edit] Scan multiple IP addresses
Multiple IP address scan from file, no pinging (P0), verbose (v), determine OS (A), do it fast (T4)
nmap -P0 -v -A -T4 -iL [file_with_IP_addresses]
[edit] Netstat
Shows listening programs & port numbers
netstat -l -p --numeric-ports
[edit] iptables
[edit] List rules
List with packet counts for rules (v) & numeric ports instead of names (n)
iptables -vnL
[edit] Clear packet counts
iptables -Z
[edit] List tables
List the NAT/Mangle table
iptables -T nat -vnL
[edit] DNS
[edit] Perform a DNS zone transfer
dig DOMAIN_NAME AXFR
** or **
dig @DNS_SERVERr DOMAIN_NAME AXFR
[edit] BIND version
dig @DNS_SERVER txt chaos version.bind
[edit] SOA
DNS Start of Authority record
dig @DNS_SERVER DOMAIN_NAME soa
[edit] GRUB
Fix your GRUB boot loader after it gets hosed from installing Windows on top of Linux (or in my case, when Ghosting to a new laptop hard-drive).
- Boot from the Ubuntu LiveCD
- Open a terminal window
- Run the grub command:
- Now enter the following command to determine where the boot partition of your linux installation is located:
- The above command will return a value that looks like (hdX,Y), where X and Y are numerical values. Type the following to tell GRUB where the boot partition is located and make it the root drive for GRUB to load from:
- Now write the updated GRUB stub loader (now with the correct boot partition) to the MBR (first 512 bytes) of the current boot drive:
- Exit GRUB
- Now cross your fingers and reboot
Application => Accessories => Terminal
sudo grub
find /boot/grub/stage1
root (hdX,Y)
setup (hd0)
quit
[edit] CD Copying / Burning
http://unix.freshmeat.net/projects/cdrecord
- Copy ISO image from CD:
- Mount image to extract files or otherwise verify the ISO image works:
- Burn CD from ISO image using cdrecord:
dd if=[input_device] of=[output-file]
Example:
dd if=/dev/cdrom of=./xp_pro.iso
sudo mount -t iso9660 -o ro,loop [iso_file] [mount_point]
Example:
sudo mkdir /mount sudo mkdir /mount/iso sudo mount -t iso9660 -o ro,loop ./xp_pro.iso /mount/iso
cdrecord -v -data speed=48 [iso_filename]
Example:
cdrecord -v -data speed=48 ./xp_pro.iso
[edit] Checking SSL Versions
At first I tried "sslthingy.sh", which worked at first but then seemed to break on me.
I then found "sslscan" @ http://www.titania.co.uk/sslscan.php To install on Ubuntu, you must first install the libssl-dev libraries, like so:
sudo apt-get install libssl-dev
Then download the sslscan source code from the website above and compile, like so:
tar -zxvf sslscan-1.7 cd sslscan-1.7 make
haha! Of course, then I found that the sslscan is included in the Ubuntu repositories (although not the very latest at the time I wrote this):
sudo apt-get install sslscan

