Posted in Unix, scripting

Unix and friends

UNIX

Knowing Unix command line is definitely not something that you’ll impress a nice girl, but it might be something that you’ll impress cute geek guy 😉

What is Unix

As I wrote before  Unix is a family of multitasking, multi user computer operating systems. I was told that my definition was not precise enough, so for those of you, who are completely not familiar with Unix, I’ll repeat:

Unix is a OS (Operation System).

It is not a tool.

It consists of large number of tools.

It’s like a mother-ship for other OSes (such as Linux or you’re favorite Mac 😉 ).

In order to talk to Unix – you’ll need to be using the command line.

(I hope this time it was explicit enough :)).

crVtQK

Moving on

In Unix-like systems the commands are quite often nothing else but tiny programs, which run from command line. They are form of shells. Most of the shells can be also used as scripting language, which enables the user to perform multiple tasks and write scripts to automate repetitive activities.

There is several scripting languages available (csh, ksh, bash). As far as I know, one of the most popular in Unix is bash.

Before you start a little chit chat with your console – it is good to know the basics – and what I mean by that is to read about FHS – Filesystem Hierarchy Standars. Unless you won’t be a smart-ass.

FHS is common for Linux and Unix systems.

Examples

Having said that, let’s move on to the most useful commands that allow you talk to Unix.

One of the cutest commands I’ve ever seen is whoami. It is a real command. It doesn’t mean that Unix would reveal the secrets of life in front of you, but after several hours of coding it is good to know your name, right?

What might be more useful in real life? What do I use on daily basis?

bash  – switch scripting language to bash

pwd – show current directory

cat   – show file content

cd    – change directory

/       – hint – in Unix (in a contrary to Windows console) we use / instead of \

cp  – copy

ls   – list

ls -l   – list with rights – this command shows hidden rights to the files inside current catalog

 -a   – list hidden files

ln  – create hard link

rm – remove file or catalog

chmod  – adding/removing rights to the files

-al      – show hidden catalogs

history – this one fellow might be useful at the beginning – it lists all previous commands

Please try it at home. Next time we’ll play a bit more with Unix. I’ll show you some tricks.

As usual, stalk me on Twitter – all of your comments are very welcome.

Cheers!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s