*************** * Linux stuff * *************** --------------- | chmod table | --------------- value read write execute 0 no no no 1 no no yes 2 no yes no 3 no yes yes 4 yes no no 5 yes no yes 6 yes yes no 7 yes yes yes ** practical ** --------------- Find [string] from unknown file: find . -name "*.*" | xargs -L1 grep -H [string] Find [file], but don't print errors: find -name [file] 2>/dev/null Run graphical [program] on (f.e. remote) machines own display: DISPLAY=:0 [program] ** System ** ------------- Set swappiness (default 60): echo [0-100] > /proc/sys/vm/swappiness Remove CLI beeps: nano -w /etc/inputrc and set: set bell-style none ** rescue ** ------------ Simplify HDD settings (useful to perform before trying to rescue data): hdparm -A0 -B255 -c0 -d0 -n0 -M128 -r1 -W0 /dev/sdx Try to rescue what is left on HDD (target could be f.e. sda6): myrescue -b1024 -B bitmap -S -r1 /dev/[source] /dev/[target] Ps. Check also ddrescue. ******************* * Debian specific * ******************* ** dpkg ** ---------- Get status of package: dpkg --get-selections [package] Set [package] on hold: echo "[package] hold" | dpkg --set-selections Show which packages are on hold: cat /var/lib/dpkg/status | grep -B1 Status | grep -B1 hold List contents of deb file: dpkg -c [package.deb] List all the files installed by [package]: dpkg -L [package] ** APT ** --------- Install from specified repository (-t flag): apt-get -t [repository] install [package] Location of packages stored (cached) by apt: /var/cache/apt/archives/ Cleaning (removing) all stored packages from cache: apt-get clean Cleaning (removing) not currently installed packages from cache: apt-get autoclean Package extended states (auto-installed or manually installed) are stored in: /var/lib/apt/extended_states