Giter Club home page Giter Club logo

ccdc's Introduction

CCDC Scripts

  • linux-scripts/ -- contains useful linux scripts

Linux: Showing differences

Use diff to show the difference of two files:

diff -u /tmp/file1 /tmp/file2

Diff two folders and show the differences

diff -qr /tmp/dir1 /tmp/dir2# Package manager tricks

Linux: Package Managers

RPM

List all installed RPM packages

rpm -qa

List all files that belong to package "mypackage"

rpm -ql mypackage

Show which package that a file belongs to

rpm -qf /path/to/file

dpkg

List all installed packages

dpkg -l

List all files the belong to the package "mypackage"

dpkg -L mypackage

Show which package that a file belongs to

dpkg --search /path/to/file

or

dpkg -S /path/to/file

Linux: Shell tricks

List the 5th column from myfile

cat myfile | awk '{print $5}'

Show the top 20 occurences of IP addresses (first column) from an Apache common log file. First column is the count, second is the IP address.

cat mylogfile | awk '{print $1}' | sort | uniq -c | sort -n | tail -n20# Integrity checking

Checksums

This stuff substitutes for a poor-man's aide.

Generate SHA1 checksums for all files in current folder and all subfolders

find . -type f -print0 | xargs -0 sha1sum > /tmp/checksums

Verify the checksums generated above.

sha1sum -c /tmp/checksums

Verify the checksums of dpkg-managed files on an Ubuntu/Debian system. Only print if files fail the checksum.

find  /var/lib/dpkg/info/ -name "*.md5sums" | xargs md5sum -c  | grep -v ': OK$'

Verify permissions and checksums of all RPM-managed files on a RPM-based distro. This only prints things that were altered.

rpm -Va

Permissions

List the attributes in CSV format of files in the current folder and subfolders (user.group, mode, size, filetype,modification time,filename):

find . | xargs -n1 stat  --format="%U.%G,en%a,%s,'%F',%i,'%y','%n'" > /tmp/perms

Sources

ccdc's People

Contributors

jaminb avatar red5d avatar trvon avatar edgester avatar

Watchers

Luke Snyder avatar James Cloos avatar John Poulos avatar  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.