Git Product home page Git Product logo

oneliners's Introduction

Oneliners

Some small, random but possibly useful snippets for various tasks for oblivious shell users

Miscellaneous

Output unique lines of a text file

cat diff.txt | sed "s/^[ \t]*//" | sort | uniq

Find content in file recursive

grep --include=*.sql -rnw . -e "pattern"

Concat the content of all alphabetically orderd txt files

find . -type f -name '*.txt' | sort | xargs cat 0 >> concat.txt

Find all filenames recursive and print them sorted

find . -exec ls -dl \{\} \; | awk '{print $9}' | sort    

Replace file content

sed -i -e 's/foo/bar/g' filename

Remove empty lines from file

sed -i '/^$/d' file.txt

Execute command in every subfolder

find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && pwd" \;

Find all entities not in persistence.xml

egrep -lir --include=*.java "@Entity" . | awk -F"/" '{print $NF}' | awk -F"." '{print $1}' | while read -r file ; do     
    if ! grep -q "$file" src/main/resources/META-INF/persistence.xml ;
    then
    echo "Missing entity $file"
    fi
done    

Pulls all git repos in subdirectories

find . -type d -mindepth 1  -maxdepth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;   

Image manipulation

Convert every JPG in current folder to PNG

for image in *.jpg ;  do magick "$image" "${image%.*}.png" ; done

Optimize every PNG in current folder

for image in *.png ;  do optipng "$image" ; done

System

Find process that is using a particular port

sudo netstat -lpn | grep :8080

Scan wifi channels

sudo iwlist wlan0 scan | grep \(Channel

List of packages installed locally

dpkg -l

List files from package(s).

dpkg -L <packagename>

Restart Pulse Audio

pulseaudio -k && sudo alsa force-reload

Docker

Remove all containers

docker rm $(docker ps -a -q)

Remove all images

docker rmi $(docker images -q)

oneliners's People

Contributors

krigu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.