Linux bits part 1

What you'll learn?

Description: You underdate the basics of Linux and you can use simple commands to navigate your system.

Person who successfully completed requirement for given block can:

  • understand the basics of Linux
  • use simple commands to navigate the system
  • find information about commands in the manual

Areas

Fundamentals
0 questions • 0 katas
Linux foundation.

Learn

UNIX File types

  • - regular file (text file)
  • d directory
  • s unix socket (unix sockets are much faster than communication over ip interface)
  • c character device (terminal)
  • b block device (like a terminal but receives blocks)
  • f named pipeline (created by mkfifo)
$ touch file.txt
$ mkdir tmp
$ ls -la | grep -E "file|tmp"
-rw-r--r--  1 bard bard    0 Jan 16 09:50 file.txt
drwxr-xr-x  2 bard bard 4096 Jan 16 09:55 tmp
file typeownergroupothers
-rw-r--r--
drwxr-xr-x
  • file type - means that is a regular file
  • rw- - file can be read/written by owner
  • r-- - file can be read group
  • r-- - file can be read by other system users
  • file type d means that is a directory (more file types could be found above in section UNIX file types)
  • rwx - directory can be read/written/executed by owner (by executed it means that owner can list files or enter to a directory)
  • r-x - directory can be read/executed

everything is a file

Outputs & inputs (aka file descriptors)

  • 0 - stdin
  • 1 - stdout
  • 2 - stderr
  • > - other

created every time a program needs to interact with files

They are split, user can redirect them to different outputs (other streams, files, sockets).

2>&1 redirects a standard error to a standard output so they appear together and can be jointly redirected to an output.

NOTE 2>1 redirects a standard error to a file called 1 NOTE ls > /dev/null 2>&1 or unknowncommand > /dev/null 2>&1 means that no outputs are printed on terminal

Useful commands
0 questions • 0 katas
Basic commands for everyday use.

Learn

  1. Please read the manual (at least description) for each command
  2. You can use documentation during the interview
  3. If you get command not found, try to install it with brew or apt or any other package manager.

NOTE just explore a command - please do not learn all possible options NOTE during testing please be careful with using rm* commands

Interview