Category Archives: Linux

View All Symlinks in a Directory Tree on Linux

This will recursively traverse the /path/to/folder and list only symbolic links: ls -lR /path/to/folder | grep ^lls -lR /path/to/folder | grep ^l If your intention is to follow the symbolic links too, use find: find -L /path/to/folder -xtype lfind -L /path/to/folder -xtype l

/etc/init.d/redis-server on Debian 9.5 Stretch

Content of /etc/init.d/redis-server on Debian 9.5 Stretch: #! /bin/sh ### BEGIN INIT INFO # Provides: redis-server # Required-Start: $syslog $remote_fs # Required-Stop: $syslog $remote_fs # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: redis-server – Persistent key-value db # Description: redis-server – Persistent key-value db […]

View Last Time a File was Opened on Debian

You can use “atime” to get last time a file or directory was opened: ls -l –time=atimels -l –time=atime To test it just try to “cat” a file: cat /tmp/file.logcat /tmp/file.log Then type: ls -l –time=atime /tmp/file.logls -l –time=atime /tmp/file.log

Fix PHP7.0-FPM Installation (Sury.org Packages)

If you get these errors with apt-get update: Err:52 https://packages.sury.org/php stretch Release server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none Reading package lists… Done E: The repository ‘https://packages.sury.org/php stretch Release’ does no longer have a Release file. N: Updating from such a repository can’t be done securely, and is therefore disabled by default. N: See […]

Server Certificate Verification failed CAfile (apt-get update)

If you get this error message after apt-get update: Err:52 https://packages.sury.org/php stretch Release server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none Reading package lists… Done E: The repository ‘https://packages.sury.org/php stretch Release’ does no longer have a Release file. N: Updating from such a repository can’t be done securely, and is therefore disabled by default. N: […]

Create a SOCKS 5 Proxy on Top of a SSH Tunnel on Linux

Just get a cheap VPS from DigitalOcean or any other company. Then login as root to the VPS and type: ssh -N -C -q -D VPS_IP:SOCKS5_PORT -p SSH_PORT localhostssh -N -C -q -D VPS_IP:SOCKS5_PORT -p SSH_PORT localhost Here is an example: ssh -N -C -q -D 54.54.54.54:1080 -p 22 localhostssh -N -C -q -D 54.54.54.54:1080 […]

Disable Compression when Encrypting with GNU GPG

By default GPG uses RFC1950 compression when encrypting a file. Use “–compress-algo none” to disable compression on GPG: /usr/bin/gpg –trust-model always –encrypt –compress-algo none –recipient ‘YOUR KEY NAME HERE’ file.tar/usr/bin/gpg –trust-model always –encrypt –compress-algo none –recipient ‘YOUR KEY NAME HERE’ file.tar To run the command in background use: nohup /usr/bin/gpg –trust-model always –encrypt –compress-algo none […]

Linux Client Tools that Support TLS (GnuTLS, OpenSSL, Socat, Ncat, Telnet-SSL)

Here are some Linux tools that support TLS/SSL connection: 1) GnuTLS has a TLS client tool on Linux, example: gnutls-cli imap.server.com -p 993gnutls-cli imap.server.com -p 993 * Use -s for STARTTLS 2) OpenSSL supports TLS via s_client option, example: openssl s_client -connect imap.server.com:993openssl s_client -connect imap.server.com:993 * Use -starttls imap or -starttls smtp for STARTTLS […]

How to create a 1GB random file in Linux

You can use OpenSSL to create a 1 GB random file in Linux: openssl rand -out sample.txt -base64 $(( 2**30 * 3/4 ))openssl rand -out sample.txt -base64 $(( 2**30 * 3/4 )) 1 Gigabyte is like 230 bytes (you can use 10**9 for 109 bytes instead). The “* 3/4” section is for base64 overhead, making […]

Prevent less from Clearing the Screen upon Exit on Linux

To prevent less from clearing the screen upon exit you can just use -X option: -X or –no-init Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen. To make less exit if the content fits on one screen, […]