Unix – I did my best


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 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).


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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s