Author: sisir

  • What are annotations in Kubernetes (k8s)? What is their purpose?

    In Kubernetes, annotations are metadata that can be added to objects in the cluster, such as pods, services, and deployments. Annotations are key-value pairs that are stored in the object’s metadata and are not used by the Kubernetes control plane. Annotations are intended to be used to store information that is relevant to the object, […]

  • What are labels & selectors in Kubernetes (k8s)?

    In Kubernetes, labels are metadata that can be added to objects in the cluster, such as pods, services, and deployments. Labels are key-value pairs that are stored in the object’s metadata and are used by the Kubernetes control plane to identify and manage objects in the cluster. Labels are intended to be used to store […]

  • How to Recursively Delete a File Type in a Directory – Unix

    How to Recursively Delete a File Type in a Directory – Unix

    Use find Example uses deletion of mp4 files. Run find /some/dir/ -maxdepth 10 -type f -name “*.mp4” You will see a list of mp4 files. Now you just need to add -delete option to delete them. The complete Command find /some/dir/ -maxdepth 10 -type f -name “*.mp4” – delete

  • How to Recursively Copy a Folder Excluding Certain File Types in Unix

    How to Recursively Copy a Folder Excluding Certain File Types in Unix

    Use rsync rsync -aP –exclude=*.mp4 /folder1/* /folder2/ -a : Recursive -P: Shows progress –exclude: You cause use file types or directory here. For multiple file types, you can use multiple exclude commands. For example –exclude=*.jpg –exclude=*.png

  • How to Enable/Disable Password Login in Unix (Ubuntu) via Command Line

    Edit the ssh config file using your preferred editor I am going to install vim. You will need root access to do this operation. vim /etc/ssh/sshd_config Then find the line with PasswordAuthentication and change the line as below PasswordAuthentication yes If you want to turn off the password authentication then you can just commented out […]

  • How to Run Node.Js Application as Different User?

    In your .env file add USER=www-data Note: I have choose to run node as the user www-data you can choose any other appropriate one. Now Run $ npm i userid –save At the top of your app.js or index.js file add const userid = require(‘userid’);const user = process.env.USER;const uid = parseInt(user), 10);// Set server’s uid […]

  • How to List Files & Directories With Size in Linux Command Line

    The command du stands for Disk Uses. You can use this command to see how much disk space a file or directory is taking. In order to list size of all files and directory of the current directory. You can run: du -sh * Explanation: du: Disk Usage -s: Display a summary for each specified […]

  • Ubuntu How to List All PHP Packages?

    grep is a very useful command to learn no matter which linux distribution you are using. For example I wanted to list all php 7.1 available packages. I can use grep command to filter out the output and show only relevant package names. apt-cache pkgnames | grep php7.1

  • How to Create Symlink via CLI in Unix – CentOS – Ubuntu – Linux

    Symbolic link or symlink ( or sometime called soft link ) is a file that only exists as a reference for another file or directory. In order to create symlink via command link interface (CLI) in an Unix based system you will need to use ln command. ln -s /path/to/file /path/to/symlink ln stands for Link.

  • How to Extract tar.gz file in Unix/Linux

    How to Extract tar.gz file in Unix/Linux

    When you are in a unix based system like Ubuntu, CentOS etc. You will need to know how you can extract a tar.gz file using command line interface (CLI) Take an example, we have a file myFile.tar.gz cd into the same directory as the file. Now run the command tar -xzf myFile.tar.gz This will create […]