28oct08
Help via "/?" "-help" "--help" or "man" or "info"
sudo su
cat shows the contents of a file head first 10 lines of file, -n parameter means n lines shown tail last 10 lines of file, -n parameter means n lines shown more shows a file with pause every page
find /var/www /home/nickg/public_html -name ".html" -type f find / test -name test*
mkdir /mnt/usb mount /dev/sda1 /mnt/usb mount -t vfat /dev/sda1 /mnt/sda1
rm //remove = delete, like rmdir rm -R * //removes everything (subdirs too!) BE VERY CAREFUL!
kill -9 processid(PID) //forces a process to terminate
swapon -s swapoff -v knoppix.swp
fdisk /dev/hda
not /dev/hda1
p (print partitions)
sfdisk -l
lists known partitions
255 heads & 63 sectors per track failsafe 2 fb640x480
/sbin/grub-install /dev/hdb
/boot/grub/grub.conf default=0 timeout=0 title "Linux" root(hd2,1) kernel /vmlinuz ro root=/dev/hdb2 intrd /intrd-z.img
lpstat //printers
/bin, /usr/bin binary files /sbin, /usr/sbin /usr/X11R6 //xwindows system /lib //shared libaries (like dll for windows) var
ZIPPING AND TAPE ARCHIVING
gunzip -d example.tgz //creates output file example.tar
gzip example.tar //creates output file example.tgz
zcat example.tar.gz | tar xvf //creates a dir called example
(http://tldp.org/HOWTO/Partition/fdisk_partitioning.html)
fdisk /dev/hda (must be /hda not /hda1) ... m (help listing of commands) p (print table) n (new partition) -> p (primary) -> 1 (first partition) -> +256M (256MB) n (new partition) -> p (primary) -> 2 (second partition) -> ENTER (default to use the rest of the drive) p (print table, should see 2 partitions /hda1 & /hda2) a (choose the active, booting partition) -> 1 (first partition) t (change a partition file system) -> 2 (second partition) -> 82 (linux swap code) p (print table, should see: /dev/hda1 * 1 32 257008+ 83 Linux /dev/hda2 33 65 265072+ 82 Linux swap w (write all the changes) q (quit without saving the changes) ...
(NOTE cfdisk is a more advanced command line "graphical" version, sfdisk is a more advanced "expert" command line version)
(http://tldp.org/HOWTO/Partition/setting_up_swap.html) (http://tldp.org/LDP/sag/html/swap-space.html)
mkswap /dev/hda2 (format!!! the 2nd partition to be a linux swap) swapon /dev/hda2 swapon -s (show the swap file usage & priority, high priority used first) swapoff /dev/hda2 (stop using the swap partition, if low on mem a bad idea) swapon -p 100 /dev/hda2 (start using /dev/hda2 with priority 100)
(Creating files that can be used as swap in linux are covered elsewhere) (http://www.xenotime.net/linux/doc/swap-mini-howto.txt)
(http://tldp.org/HOWTO/Partition/formatting.html)
mkfs -t ext2 /dev/hda1 (formats /dev/hda1 to the ext2 file system, not ntfs/fat, for linux) (or mk2efs /dev/hda1 which by default creates an ext2)
tune2fs -m 1 /dev/hda1 (tunes the new files system to reserve 1% for the root user) tune2fs -L /dev/hda1 main (gives /dev/hda1 a permanent label) e2fsck /dev/hda1 (checks the file system for errors) dumpe2fs /dev/hda1 | grep "Block count" (find the # of blocks for recovery)
extended partitions are logical partitions defined on top of a single primary partition... when choosing a size it's easisest to type +536M (536 Megabyte partition) (or you could just hit enter and use it all...) instead of 65 cylinders (multiplied by 16,065 tracks by 512 bytes per sector) =
http://www.mcp.com
To telnet to a site type in telnet www.victim.com ,to telnet toa
site on a specific port type in telnet www.victim.com portnumbe. Let's say
i wanted to telnet to port 25 i would type in telnet www.victim.com 25 .
To FTP to a machine type in ftp www.victim.com. To rlogin to a machine,
many of you proably dont know what the hell im talking about so let me
explain. If you place a file called .rhosts in someones home directory and
that file has two plusses like this + + in it you can use the rlogin command
to log into the system using that account without a password. Ring a bell
in your mind? filling with fresh ideas. I use this method whenever I geta
shell account, it assures me that if they by any chance change the passowrd
I can always rlogin into the system assuming that the account has a .rhosts
file in it and the file contains + + then you're in good shape. Assume the
username of the account is lamer. So inorder to rlogin into lamer's account
we would do the follwoing. Type in rlogin www.victim.com -l lamer . This
will telnet us directly into lamer's account where we can start rooting the
system.