MicMek's Blog CopTECH


Useful Linux Stuff

Here are some useful stuff I need to blog about just in case I need to find them again. Also, some side notes to help me get to know linux better

Copying problem

when you are copying a folder to another place and you want to rename that folder then DONT create that folder first!!
If I have /home/micmek/testA and I want to copy it to /home/micmek/workingA
If folder workingA already exists then

cp /home/micmek/testA /home/micmek/workingA

will produce


but if the folder doesnt exist then the SAME command will produce



Symbolic Links vs. Hard Links

Symbolic links point to the file/folder path
Hard links find the Inode that the file is pointing to and points to the same Inode (Data/Content)
Folders have to be symbolic link

ln -s /usr/local/Adobe/bin/acroread acroread

Useful commands

Exiting SSH

Type ~. and you will exit ssh

Boot Log

To find out the log messages from your the booting up of linux ie. all the hardware info type


This is useful for mounting purposes too.


To find out where a file that you commonly execute is in the path structure type the following

whereis cat

Find string in path

To find a certain pattern in a set of files then type

find . | xargs grep 'XXX'

This returns all the files that contain that string

Size of folder

To find the size of a folder type (uses the Disk Usage command)

du -ks PATH

File Permissions

Confusing as it is it's pretty simple

chmod OGO file

Where OGO is a 3 digit number.
O-Owner G-Group O-Other Users
4 = READ || 2 = WRITE || 1 = EXECUTE
So if you want a file to be

Owner Group Others
Read (4) 4 4 4
Write (2) 2 0 0
Execute (1) 1 1 1
Total 7 5 5

Changes owner of file

chown USER file


List of mounted devices

To find out what has been mounted type df


Mounting & Unmounting

To mount type

mount -t TYPE /dev/DEVICE PATHmount -t vfat /dev/sdb /mnt/usb

To unmount type

umount PATHumount /mnt/usb

Mounting & Unmounting SSH path

To mount a sshfs type

sshfs HOST:PATH TARGETsshfs example.com:/stuff /media/home-pc

To unmount type

fusermount -u PATHfusermount -u /media/home-pc

More Info here:
how to mount a remote ssh file system using sshfs


Services are started and stopped through the following command:

/etc/init.d/SERVICE start/etc/init.d/SERVICE stop

Linux Folder structure

Logs are kept under


Software is usually installed under



To install a package use

sudo apt-get install XXX

To install a package use

sudo apt-cache search XXX

To find out where a package is installed type

Tagged as: , , No Comments

Power of Cygwin

I just found out some cool tricks in Cywgin and Putty.

1. I know how to store passwords now using
PuTTY Key Generator
This is done by generating a public key and putting it onto your server under ~/.ssh/autherizationkeys
and putting the private key anywhere on your computer and then pointing to it from the PuTTy Configuration "Private Key file Authentication"

2. I now know how to create a SSH Daemon so that I can log into my computer's ssh terminal.
check out this site...

another cool cygwin reference

Pretty cool!

Tagged as: , No Comments