Saturday, December 12, 2015

Difference between ADD and COPY in docker

The commands for deleting the containers and images are
The major difference is that ADD can do more than COPY:
  • ADD allows the source to be an URL
  • Also If the  parameter of ADD is an archive in a recognised compression format, it will be unpacked

Friday, December 11, 2015

Remove docker images and containers

When we use docker we end up running a lot of containers and creating a lot of images

The commands for deleting the containers and images are

#docker stop all containers
docker stop $(docker ps -a -q)

#docker remove all containers
docker rm $(docker ps -a -q)

#docker remove all images
docker rmi $(docker images -q)

Wednesday, September 23, 2015

Getting started with UNIX - Basic commands


List of basic commands of unix

reboot - Immediately stops all running processes, shuts down the system, then reboots.
sudo - Runs commands as root, which means no limitations due to permissions.

shutdown - Stops all running processes and shuts down the system.
Parameters can be specified to issue a delayed shutdown or a shutdown at a particular time.

date - Prints out the current system date and time.
Specified parameters can change the format of the output.

df - Reports the disk space usage for the file system.
hostname - Displays the name of the current host system.
ps - Displays information about all of the processes currently running on the system.
du - Disk usage
ps - List running processes

To know the process id of a process running
 ps -elf | grep process_name
 ps -fA | grep process_name

| -> pipe character is very useful for redirecting output of one command to other
 grep is used to find the pattern

To create a file
 cat filename
 touch filename

To search something in a file
 grep -i thing_to_be_searched filename

To search something across directories
 grep -rn pattern_to_be_searched directory_starting_from_where_search_to_be_started 

To view processes along with the memory they are consuming run
 top
Ctrl + M will sort in decreasing order of memory consumption

chmod / chown - Changes the access permissions of one or more files (chmod) or
changes the ownership of a particular file to a new user (
chown).
Only users with permission or ownership of a file can change that file’s permissions or ownership.

chown owner_name filename
chmod 755 filename  

Here 7 is the permission for owner
5 and 5 for group and others respectively

7 - xrw
5 - xr
2-r
4-x
1-w

Access permissions are of three types
 x Execute permissions (4)
 r Read permission (2)
 w write permissions (1)

Aur linux has concept of owner, group and others.

Owner is the owner of the file
Every file or directory belong to a group
And third is others(not owner and not belonging to the group of the file)

Permissions are in the order Owner permissions Group permissions  others permissions

Wednesday, February 12, 2014

How to know the hostname of your system

Here is a step by step guide on how to achieve this

1) Press Windows + R and type cmd then press Enter or search for cmd by pressing Windows key

2) In the command prompt type hostname and you will get your the hostname of the system














Enjoy :)