How to remove invalid characters from filenames?

One way would be with sed: mv ‘file’ $(echo ‘file’ | sed -e ‘s/[^A-Za-z0-9._-]/_/g’) Replace file with your filename, of course. This will replace anything that isn’t a letter, number, period, underscore, or dash with an underscore. You can add or remove characters to keep as you like, and/or change the replacement character to anything … Read more

In Linux, what is the difference between “buffers” and “cache” reported by the free command?

The “cached” total will also include some other memory allocations, such as any tmpfs filesytems. To see this in effect try: mkdir t mount -t tmpfs none t dd if=/dev/zero of=t/zero.file bs=10240 count=10240 sync; echo 3 > /proc/sys/vm/drop_caches; free -m umount t sync; echo 3 > /proc/sys/vm/drop_caches; free -m and you will see the “cache” … Read more

Testing UDP port connectivity

There is no such thing as an “open” UDP port, at least not in the sense most people are used to think (which is answering something like “OK, I’ve accepted your connection”). UDP is session-less, so “a port” (read: the UDP protocol in the operating system IP stack) will never respond “success” on its own. … Read more

protocol version mismatch — is your shell clean?

One of your login scripts (.bashrc/.cshrc/etc.) is probably outputting data to the terminal (when it shouldn’t be). This is causing ssh to error when it is connecting and getting ready to copy as it starts receiving extra data it doesn’t expect. Remove output that is generated in the startup scripts. You can check if your … Read more

What does “debconf: delaying package configuration, since apt-utils is not installed” mean?

apt-utils contains the /usr/bin/apt-extracttemplates program which is used when packages need to ask you questions about how to be configured. This package being Priority: important, means it should really be installed except in rare circumstances. If there is configuration pending, dpkg-reconfigure [package] will perform it. If you missed configuring a number of packages and don’t … Read more

Transfer 15TB of tiny files

I have had very good results using tar, pigz (parallel gzip) and nc. Source machine: tar -cf – -C /path/of/small/files . | pigz | nc -l 9876 Destination machine: To extract: nc source_machine_ip 9876 | pigz -d | tar -xf – -C /put/stuff/here To keep archive: nc source_machine_ip 9876 > smallstuff.tar.gz If you want to … Read more

Best way to disable swap in Linux

Identify configured swap devices and files with cat /proc/swaps. Turn off all swap devices and files with swapoff -a. Remove any matching reference found in /etc/fstab. Optional: Destroy any swap devices or files found in step 1 to prevent their reuse. Due to your concerns about leaking sensitive information, you may wish to consider performing … Read more

How to check the physical status of an ethernet port in Linux?

$ ethtool <eth?> For example: $ ethtool eth0 provides: Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)