Use .htaccess to Stop People From Viewing Files in a Directory.

Open the directory with your favorite FTP client – unless you’re local and can just navigate to the directory.

Add a file called .htaccess. The ‘.’ is important and mandatory.

The permissions for .htaccess should be 644.

Edit the .htaccess file with a plain-text editor (don’t use a word-processor application) and add the following line:

[code]Options -Indexes[/code]

Save the file.

What this will do is prevent indexing the files in the folder. If people try to access the folder directly, they’ll get a 403 forbidden error.

At the same time, you can still link directly to files in that folder.

So, let’s say you added the .htaccess to a directory called /tmp. You can still link to, use, and send people to /tmp/picture.jpg like normal, but people won’t be able to browse the directory and find files you don’t want them to see.

For more information,  click this.




Prevent Duplicates in Bash History

As you may have noticed, bash keeps a history. If you open your terminal and push the up arrow, you’ll see the last command you used. This fills up with duplicates. This is how you ensure it doesn’t keep duplicates.

It’s pretty easy. Just open your terminal and enter:

[code]echo ‘export HISTCONTROL=ignoreboth:erasedups’ >> ~/.bashrc[/code]

After that, bash should no longer keep duplicates of previously entered commands.

See? Linux is pretty simple.




How To: Enable PPAs With Elementary OS

Elementary, like Debian and some other Debian derivatives, doesn’t support PPAs out of the box. In order to use them, you’ll have to install `software-properties-common`.

Open your terminal with CTRL + ALT + T and simply enter the following:

sudo apt install software-properties-common

Once you’ve done that, you can add PPAs in the normal way. For example, this is a LibreOffice PPA:

sudo add-apt-repository ppa:libreoffice/ppa




How To: Find the hostname.

The hostname is, for many of you who will be reading this, the same as your username. This is not always true.

Why is it important? Well, if I want to connect to a box on my network, I use its hostname. For example:

ssh kgiii@kgiii-lmde.local

That means I don’t need to know the IP address of the box, I merely need to know the hostname. That, as I said, is usually your username. On the off-chance that it isn’t, it’s easy to find.

cat /proc/sys/kernel/hostname

And there you go.




“Best” ‘inxi’ Command?

If you don’t know about inxi, you’re either really new to Linux or you’ve been living under a rock. It’s a tool to give you information about your computer. So, what is inxi? This is what ‘man inxi’ has to say:

inxi is a command line system information script built for for console and IRC. It is
also used for forum technical support, as a debugging tool, to quickly ascertain user
system configuration and hardware. inxi shows system hardware, CPU, drivers, Xorg,
Desktop, Kernel, GCC version(s), Processes, RAM usage, and a wide variety of other
useful information.

It’s actually fairly complicated and has a ton of options. So, what’s the best? 

Personally, I have ‘inxi’ aliased to be ‘inxi -v 5’. It gives me a great deal of information and generally has all the information I’d be looking for.

Here’s an example output from one of my older computers that I’m running VMs on:

[code]kgiii@kgiii-lmde:~$ inxi -Fxxxz
System: Kernel: 5.4.0-56-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Console: tty 1
dm: LightDM 1.30.0 Distro: Linux Mint 20 Ulyana base: Ubuntu 20.04 focal
Machine: Type: Desktop System: Dell product: OptiPlex 3010 v: 01 serial: <filter> Chassis:
type: 15 serial: <filter>
Mobo: Dell model: 0T10XW v: A01 serial: <filter> BIOS: Dell v: A22
date: 11/29/2018
CPU: Topology: Quad Core model: Intel Core i5-3570 bits: 64 type: MCP arch: Ivy Bridge
rev: 9 L2 cache: 6144 KiB
flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 27138
Speed: 1596 MHz min/max: 1600/3800 MHz Core speeds (MHz): 1: 1597 2: 1596 3: 1597
4: 1597
Graphics: Device-1: Intel Xeon E3-1200 v2/3rd Gen Core processor Graphics vendor: Dell
driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:0152
Display: server: X.org 1.20.8 driver: modesetting unloaded: fbdev,vesa tty: 96×36
Message: Advanced graphics data unavailable in console. Try -G –display
Audio: Device-1: Intel 6 Series/C200 Series Family High Definition Audio vendor: Dell
driver: snd_hda_intel v: kernel bus ID: 00:1b.0 chip ID: 8086:1c20
Sound Server: ALSA v: k5.4.0-56-generic
Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Dell
driver: r8169 v: kernel port: e000 bus ID: 02:00.0 chip ID: 10ec:8168
IF: enp2s0 state: up speed: 100 Mbps duplex: full mac: <filter>
IF-ID-1: vmnet1 state: unknown speed: N/A duplex: N/A mac: <filter>
IF-ID-2: vmnet8 state: unknown speed: N/A duplex: N/A mac: <filter>
Drives: Local Storage: total: 476.94 GiB used: 111.16 GiB (23.3%)
ID-1: /dev/sda vendor: Team model: T253X2512G size: 476.94 GiB speed: 3.0 Gb/s
serial: <filter> rev: 7B0 scheme: MBR
Partition: ID-1: / size: 467.96 GiB used: 111.16 GiB (23.8%) fs: ext4 dev: /dev/sda5
Sensors: System Temperatures: cpu: 29.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info: Processes: 246 Uptime: 2d 57m Memory: 15.54 GiB used: 1.98 GiB (12.7%)
Init: systemd v: 245 runlevel: 5 Compilers: gcc: 9.3.0 alt: 9 Shell: bash
v: 5.0.17 running in: tty 1 (SSH) inxi: 3.0.38[/code]

As you can see, that’s a lot of information and that’s exactly the information I (and others) need to know to help you in many situations. So, when I ask for your inxi output, that’s exactly what I want to see.