Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
In order to create a debian package from your shell script do as follow:

Let's consider our package name is dangling. We need to create 2 folders, first is called dangling and the second is DEBIAN which is inside of the dangling folder:
mkdir helloworld && mkdir helloworld/DEBIAN

You can copy the files into your package with the full paths on the destination filesystem. E.g. if you want to put a file in /usr/local/bin/ you put it in dangling/usr/local/bin/:
mkdir -p dangling/usr/local/bin
cp /usr/local/bin/dangling.sh dangling/usr/local/bin/

In your DEBIAN directory (created at the begining of the post), create a control file with the below content:
<span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; white-space: pre;">Package: dangling
</span><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; white-space: pre;">Version: 0.1
</span><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; white-space: pre;">Maintainer: Alireza Hoseini
</span><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; white-space: pre;">Architecture: all
</span><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; white-space: pre;">Description: would wipe all docker dangling volumes out

NOTE: These are the mandatory fields in the control file.

Now build the package using dpkg-deb:
dpkg-deb --build dangling

This creates a dangling.deb file, which you can now install on any Debian installation with following command:
dpkg -i dangling.deb

#debian #deb #create #package #dpkg #build
See live disk IO status by using iostat:

iostat -dx 1

The output has many columns. The part I'm interested in for now is r/s which refers to read per second and w/s which is write per
second. To see size per second in read and write see columns rkB/s, wkB/s in their corresponding order.

NOTE: if you don't have iostat on your linux os install it on debian by issuing apt-get install sysstat command.


#linux #debian #iostat #read_per_second #write_per_second #sysstat
If you want to disable mouse in vim 8 in new Debian, put the below line in your ~/.vimrc:

set mouse=c

It just kills me when I want to work with vim with mouse enabled!

#linux #debian #vim #mouse_enabled
In debian linux you can check a directory size by du -h -d 1, BUT in CentOS it is a little bit different:

du -sh /path/to/dir/*

#linux #du #centos #centos #debian
Virt-builder is a tool for quickly building new virtual machines. You can build a variety of VMs for local or cloud use, usually within a few minutes or less. Virt-builder also has many ways to customize these VMs. Everything is run from the command line and nothing requires root privileges, so automation and scripting is simple.

To see available virtual machines:

virt-builder --list


Sample command to create a debian-9 image:

sudo virt-builder debian-9 --size=50G --hostname prod.example.com --network --install network-manager --root-password password:YOUR_PASS


The above command creates a debian 9 image with disk size of 50GB and sets the hostname to prod.example.com. --network enables the networking on guest and --install installs packages on the target O
S. The last parameter sets the root password to YOUR_PASS.

To read more about the axtra parameters:
- http://libguestfs.org/virt-builder.1.html

#linux #sysadmin #virt_builder #debian #image
In Debian based OSes if you want to install Postman you need to download the binary package and run it everytime you need. But there is a better way for it that you can access Postman system wide. There is
gist in github for it:
- https://gist.github.com/SanderTheDragon/1331397932abaa1d6fbbf63baed5f043

Download shell and run it! (Be careful and read any shell script before running it, I've read it myself)

Now you can add it to favorites and have instant access to it.

Spread your love for m2sh :)))

#postman #debian #ubuntu #shell #gist #github