Categories
linux

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!!
eg.
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

/home/micmek/workingA/testA

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

/home/micmek/workingA

Links

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

dmesg

This is useful for mounting purposes too.

Paths

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

Mounting

List of mounted devices

To find out what has been mounted type df

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

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

/var/logs/XXX

Software is usually installed under

/usr/local

Package

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

Categories
Cygwin linux

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
PLink
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…
http://qcwizards.chem.warwick.ac.uk/~yousaf/tips/cygwin/index.htm

another cool cygwin reference
http://www.astro.umd.edu/~harris/cygwin/

Pretty cool!

Categories
Other

Intro

Hey People!!
I’ve been thinking about doing a website for my self for a while now. I did start one at this website http://micmek.is-a-geek.com but this only works when my computer is on… so that’s not good.. hmmm..

So, Tada…Here is the website that I will be using to broadcast what ever I want to say. I find it a good opportunity for me to start using blog posts as well as see what other people think of what I say.

My aim of this Blog post is to focus on two of my Hot Favourite topics… which are:

  1. Coptic Church – Anything to do with this from Egypt affairs, Church Events, Youth Events, etc.
  2. Techno – no… this is not music.. lol… anything to do with Technology (the dreaded word for some people)

So if you find an interest in either of these, or if you are forced to read some of my blogs because you hate Technology then I hope you have enjoy reading my awsomley kewl blogs! … now lets see if i can do a Smiley face in here… hmm I can’t anyway =)

Enjoy the Power of CoptoSoft!