When copying a large file on Linux transfer hangs at the end… And you want to f**king kill someone.

There’s an annoying bug in almost every Linux distribution I’ve worked with. When your copying a large file to usb device (pendrive etc.) it hangs at the end (I mean it haaaaaaaaaaaaangs).

I’ve found a solution that works on Elementary and Ubuntu (at least).

Simply paste this two commands in your terminal:

sudo sh -c 'echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes'
sudo sh -c 'echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes'

Add this to some kind of startup script and forget about transfer problems…

How to watch file count in a directory (Linux/macOS)?

If you want to monitor file count in some directory simply use this:

watch "ls -A | wc -l"

You can also mask specific files using asterisk char:

watch "ls sess* -A | wc -l"

If you get Argument list too long error, please change command syntax to this:

watch "ls -U | grep -c '^sess'"

How to mirror (statically) a website?

If you want to copy a website really really fast use HTTrack with following switches:

httrack http://website.com/ -K --sockets=50 --disable-security-limits --max-rate=0

It works on Linux (there’s a native Debian package) and Windows.

Check documentation for other options. K is very important because it affects link generation. If you want original links without html extensions use it like above.

K option cheatsheet:

βˆ’K0foo.cgi?q=45 βˆ’> foo4B54.html?q=45 (relative URI, default)
βˆ’Kβˆ’> http://www.foobar.com/folder/foo.cgi?q=45 (absolute URL) (βˆ’βˆ’keepβˆ’links[=N])
βˆ’K3βˆ’> /folder/foo.cgi?q=45 (absolute URI)
βˆ’K4βˆ’> foo.cgi?q=45 (original URL)
βˆ’K5βˆ’> http://www.foobar.com/folder/foo4B54.html?q=45 (transparent proxy URL)

And last but not least…

If you want to rewrite original links to html static links use this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.html
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

Use psexec to troll your work colleagues

If you’re an admin in a windows environment you can troll your friends a little bit πŸ™‚

Install psexecΒ and use bellow command to run Rick Astley’sΒ famous “sweet troll of mine” on a remote computer (background, no window!).

psexec64 -s /user:domain\user -i \\xxx.xxx.xxx.xxx "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app="https://youtu.be/dQw4w9WgXcQ"

xxx.xxx.xxx.xxx – stands for an ip number of a trolled person.

PS. Make sure you’re using psexec64 not psexec because it may not work on modern systems (tested on Windows 10).

A MAN LEARNS THROUGHOUT HIS WHOLE LIFE

If you’re a fan of Firefox (mainly because it’s an awesome tool for webdevelopment) like me. You should already know that there’s an additional console for developers (I’ve did not until five minutes ago). When you press Shift + F2 it shows little input bar on the bottom of the window. For example type the following command :

screenshot --clipboard --fullpage

Press Enter and BANG! Screenshot of a entire page in your MEMORY!

Mother of God… This is so awesome!

PS. Try different commands, you can use Tab for completion and help to list them all.