Posted in databases, scripting, Unix

Unix – I did my best

1nnpyr

Hi Boys and Girls!

After my previous Unix-related post some of you complained that it was too short, to little knowledge and more meh than wow. This time I decided to do my best and fulfill all your Unix desires ­čÖé

One of my biggest discoveries about Unix (and command line in general) is that
YOU HAVE TO KNOW.

You have to know where your file is.

You have to know what is the path to the folder in which your file would be stored.

You have to know how to do things.

In order to know things – I’ve gathered bunch of tips and commands that might be useful. ­čÖé

At first – commands!

File management:

  • cat –┬áConcatenate and print files
  • chgrp –┬áChange the file group ownership
  • chmod –┬áChange the file modes/attributes/permissions
  • chown –┬áChange the file ownership
  • chattr – ┬áChange file attributes
  • cd ┬á – Change directory
  • cd – – Change to previous directory

(hint: cd without provided directory will take you back to home catalog – with the specified path will take you to that directory.

It is also possible to move up step by step or several parent directories at once, for example:

cd ../../../ ┬á – will move you 3 cataloges up)

  • df –┬áReport free disk space
  • echo –┬áWrite arguments to standard output
  • file – ┬áDetermine file type
  • find – ┬áFind files
  • gzip – Zip files
  • gunzip – Unzip files
  • ln┬á –┬áLink files
  • ls – List directory contents

(ls –color will list your files with selected color)

  • mkdir –┬áMake directories
  • more –┬áDisplay files on a page-by-page basis
  • mv –┬áMove or rename files

For examlpe – if you wanna rename test1 file into test45 – your command would be like this: ┬á┬ámv test1 test45

  • pwd –┬áprint working directory – Return working directory name
  • rcp – Transfer files to the remote host
  • rm – Remove files and catalogs
  • rmdir – Remove directories, if they are empty.
  • split –┬áSplit files into pieces
  • touch –┬áChange file access and modification times
  • umask –┬áGet or set the file mode creation mask
  • unlink –┬áCall the unlink function

File system management:

  • badblocks – badblocks control
  • df – Report free disk space
  • dd –┬áConvert and copy a file

Process management:

  • at –┬áExecute commands at a later time
  • cron – Regular process run during┬ágiven timeframe.
  • fg –┬áRun jobs in the foreground
  • kill –┬áTerminate or signal process.
  • killall –┬áTerminate or signal all processes with given name.

Sounds Metallica-ish, doesn’t it?

  • ps –┬áReport process status
  • watch – Monitor command result

(For the watch ­čśë )

  • nice –┬áInvoke a utility with an altered nice value

Users and systems management:

  • clear – Clear console / terminal
  • login – Log in to the system
  • passwd – Change password
  • su – Log into other user’s account
  • sudo – Run process with root rights
  • who –┬áDisplay who is on the system
  • whoami –┬áDisplay┬áwhat user are you currently using

Text editing:

  • cut –┬áCut out selected fields of each line of a file
  • grep –┬áSearch text for a pattern
  • head –┬áCopy the first part of files
  • more –┬áDisplay files on a page-by-page basis
  • vi –┬áScreen-oriented (visual) display editor

Comment time

People usually don’t know all Unix commands by heart – they collect the most useful ones in random txt file and use them (or use history command), believe me. To use Unix – you don’t have to know them all. Take it easy.

To manage your Unix account – you’ll need a login and password. Nice tool to manage Unix (or Linux) commands is Putty┬á(such fabulous UI design) – give it a try ­čÖé

Command line allows you to combine multiple commands and get precise results.

On the other hand, you may be thinking how Unix will be helpful in testing activities? In the same way as in development – you are able to manage your files quickly or run shell scripts. In addition, everyone is able go through the same logs, search for useful scripts, go inside them, look around and modify, if necessary.

You can also narrow down your search results, using grep, or make sure that the log you are looking for at the moment is the same one, which has been generated
a moment ago – not last month.

Furthermore, you are able to color your results, number the rows and save all modifications. All of that ┬á– using just pure commands – without GUI. Sounds strange – but it works – and, to be honest, a lot of people work this way.

One account – multiple users

There is a very important thing to remember when working on Unix account.

I did mention before – companies (projects) use Unix or Linux, because it is possible to work on the remote machine – even by multiple users at once. On the other hand, those users usually have rights to modify the same files. What dose it mean? You have to be precise and careful what you are doing.

I hope that my guide made you curious and you’ll experiment with Unix, Linux and command line. It is not as scary as you think.

Do you have any favorite commands? Did I miss something important?┬áDon’t be shy – you can comment down below.

Stalk me on Twitter (@KingaTest).

Cheers!

Advertisements
Posted in databases, Unix

Introduction to Unix

One day this unexpected situation comes.

This is Linux.

This is your console.

We use Unix.

Enjoy.

introduction

It wasn’t that bad:) Fortunately, I’ve received a good companion to get familiar with Unix and not to drown. Let’s get to the point.

What is Unix

miniux

For those, who use Windows on daily basis it might be surprising. Sure we are aware that there is something more out there (like Mac ­čÖé ) but Unix? Linux, Unix, they are operation systems just like your beloved Windows ­čÖé

Traditionally, let’s start from Wikipedia’s definition:

Unix is a family of multitasking, multi user computer operating systems that derive from the original AT&T Unix, developed starting in the 1970s.

You may be familiar with Linux, Unix is a bit similar. They have common source and behave in a similar manner.

Linux is a pure Kernel – Unix consists of Kernel and some additional software. Linux is free – Unix – in most cases – is not ­čśŽ What is more, Linux, originated from a programmer’s toy – became a powerful tool for large machines. Unix though, starting from exclusive , expensive environments, nowadays is used on small PCs.

What you have to know – there are different types of Unixes. They are comparable, but not exactly the same. To talk to Unix you need to get familiar with any shell.

Why do we need them anyway?

We need Unix in order to work on remote desktops – or – to enable multiple users to use one space. What is more – each Linux/Unix enthusiast would tell you that it’s reliable. They won’t prompt you seven times if you REALLY REALLY wanna delete this file, but at the same time, they won’t run an update in the middle of conversation ­čÖé

Unix is a common “tool” used by large companies. It is very useful in working with databases.

You have to make some effort to get familiar with console and simple script languages, but if I was manage to do so – you’ll be able to to that for sure:)

In my next posts I would go a bit deeper into subject and move on with simple commands, that are useful for me in testing activities and managing files.

Here you can find more complex information about what Unix is.

As always – I recommend you to install it by your own and just play around. You could also get familiar with Unix with this simple course from Codeschool here (no, the don’t pay me, they just have awesome courses) .

Stalk me on Twitter. Enjoy. ­čÖé

Posted in databases, Uncategorized

After hours – it’s friday #pi─ůteczek

chill-out

Hi bored IT guys and girls

You’ve been thinking – what to do on Friday? Check my after – hours Top10 IT song list­čÖé

Not always should you be as serious as everybody think you are.

Preparing that song-set made me fun. I was trying to choose the best known songs – but I encourage you to comment with your own ones. There is plenty on the internet. My list is subjective – because it’s mine!
My criteria: we all know it / they are funny/ people sing well/ they are creative.
Try with your own one – I’m challenging you:)

#BestITSongChallenge

What do you think?

  1. The best known – the one and only – “And so you Code”

    1
  2. Something exclusively for QAs – “Hello from QA”

    4

  3. A song about benefits of live-patching – “Uptown Funk (remix)”

    6

  4. And the one about SUSE love – “Can’t stop the SUSE”

    9

  5. Code Monkey! – “Code Monkey”

    8

  6. Exclusively for all #Javistas – “Java is life”

    5
  7. Let’s pretend it’s a song – I love it :):):) “Java forever and ever”

    java

    The best from Poland (I could provide you with the translations :)) :

  8. “Internety robi─Ö” – yes we do

    10

  9. How to make a proper IT Conference commercial : “Programistok 2016” (yey!)

    2

    10. That is hideous, but still funny! :D:D – “My Informatycy”

    3

Hope you’ll enjoy all of them:) Cheers.