Friday, 30 March 2018

Linux from the command line | Linux tips & tricks -- benchmarking Linux

Linux from the command line | Linux tips & tricks -- benchmarking Linux

At some point you just have to know, how fast is it? Your car, your hamster, and your Linux box. Here you go.

Lately I've been running sysbench after every system update in order to try and track any change in performance due to the ongoing fixes for Meltdown/Spectre using:
sysbench --test=cpu --cpu-max-prime=10000 run --num-threads=
https://www.howtoforge.com/how-to-benchmark-your-system-cpu-file-io-mysql-with-sysbench

Linux for sysadmins -- Installing SquidGuard & Squid proxy server on CentOS 7

Linux for sysadmins -- Installing SquidGuard & Squid proxy server on CentOS 7

The combination of Squid and SquidGuard is one that most businesses should consider. It allows you to reduce Internet bandwidth usage, monitor usage, increase speed and responsiveness to the users, and filter unwanted sites and content easily but at as fine a grained level as you need for your application. CentOS is a great choice to host this combo and the whole system runs well on everything from virtual machines, to last year's upcycled desktop PC, to high end dedicated server hardware.

In smaller shops I've often taken desktop PC's that were pulled when new PC upgrade cycles were complete, maxed out their RAM, and added a quality hard drive and an external storage solution, like a RAID enclosure, or simple external SATA drive. Throw it all on a UPS and keep some cold spares handy from the rest of the old PC's and away you go.

I've even run this at home at times when I lived in locations with slow and or metered Internet access.
http://linuxtechlab.com/install-squidguard-with-squid-proxy-server-complete-guide/

Linux tips & tricks | Linux for sysadmins -- creating and expanding swap partitions with LVM

Linux tips & tricks | Linux for sysadmins -- creating and expanding swap partitions with LVM

LVM is a great tool that every sysadmin and many home users should be familiar with. It let's you remove the hard connection between volumes and partitions on your storage devices, enabling you to grow, shrink, move, and span your partitions across multiple physical devices and partitions.
Using it under your swap partition allows you to grow your swap size down the road should your swap needs grow.

Note that OpenSUSE users can, and should, perform these functions using the YaST2 administration tool's partition manager function ("Partitioner").
https://www.2daygeek.com/how-to-create-extend-swap-partition-in-linux-using-lvm/

Linux from the command line -- Getting your news from the terminal

Linux from the command line -- Getting your news from the terminal

OK, this is a bit much even to me, but hey if you really don't like to use the GUI or the web, here's your answer.

https://www.tecmint.com/newsroom-commandline-linux-news-reader/#

Linux from the command line -- Working with calendars on Linux

Linux from the command line -- Working with calendars on Linux

If you think about it, there are a lot of reasons to want calendar tools available from the command line, especially for sysadmins. Some of these tools can be integrated into scripts as well for even more utility.
https://www.networkworld.com/article/3265752/linux/working-with-calendars-on-linux.html

Learning Linux | Linux from the command line -- How to read man pages, a core Linux skill

Learning Linux | Linux from the command line -- How to read man pages, a core Linux skill

People often say Linux (UNIX) is hard to learn or use, but really they are not. They are simply unfamiliar. Luckily the system has built in tools to teach you how to use it. The man command is key to that. For any Linux, or UNIX, command there is a corresponding MANual page that will teach you how to use it. Just type "man "
Here's how to get the most out of the result.
https://www.maketecheasier.com/read-linux-man-page/

Linux from the command line -- Using tar to backup files and directories

Linux from the command line -- Using tar to backup files and directories

The tar command is one that has been around since the early days of Unix. It's a simple yet powerful tool that is the grandfather of zip and other tools like it.
https://www.ostechnix.com/how-to-archive-files-and-directories-in-linux-part-1/

Monday, 26 March 2018

Linux tips & tricks -- One simple way to capture video

Linux tips & tricks -- One simple way to capture video

One of the nice things about Linux is that there are lots of ways to do things. From elaborate GUI programs to simple command line options.
https://opensource.com/article/18/3/digitizing-vhs-fedora

Linux tips & tricks -- Tools for writers

Linux tips & tricks -- Tools for writers

So you've moved to Linux but you're a writer by trade or hobby and need good tools. No problem.
https://opensource.com/article/18/3/top-Linux-tools-for-writers

Linux from the command line -- Making named pipes on Linux with mkinfo

Linux from the command line -- Making named pipes on Linux with mkinfo
https://www.howtoforge.com/linux-mkfifo-command/

Linux from the command line -- Search DuckDuckGo from the command line with ddgr

Linux from the command line -- Search DuckDuckGo from the command line with ddgr
https://www.2daygeek.com/ddgr-duckduckgo-search-from-the-command-line-in-linux/

Linux from the command line | Linux tips & tricks -- transferring files from the command line with QR Codes

Linux from the command line | Linux tips & tricks -- transferring files from the command line with QR Codes

Superbeam is my go to file transfer app, but this is pretty cool. It let's you do a quick file transfer to your phone right from the command line.
https://www.ostechnix.com/transfer-files-from-computer-to-mobile-devices-by-scanning-qr-codes/

Sunday, 25 March 2018

Linux from the command line -- Using Meltdown/Spectre to learn a few new command line tricks


Linux from the command line -- Using Meltdown/Spectre to learn a few new command line tricks

So today I was getting ready to post a little trick about using egrep to highlight things you're looking for when I also discovered something really cool.
But let's start with the egrep trick.
By now if you've been following my "Linux from the command line" posts then you should have learned the basics of grep which let's you find things in other things. Like a word or phrase in a file or command output.
But what if the line grep returns is a long, cluttered line with a lot of kinda random words? egrep to the rescue.
Suppose you want to know if your CPU supports virtualization and you want the command to work with either an Intel or AMD CPU. Try this.
egrep --color -i "svm|vmx" /proc/cpuinfo
If your CPU supports either of those virtualization functions you'll see them highlighted in the output.

OK, now to the cool part
Since Meltdown and Spectre the CPU manufacturers have been working hard along with the Linux kernel developers to fix these bugs. One place this is happening is in the CPU's microcode and another is in the kernel CPU tables.
SO, try this.
egrep --color -i "meltdown|spectre" /proc/cpuinfo

The Linux CPU identification process includes an entry for bugs which simply enough lists the known bugs for that CPU. If you're using any kind of modern CPU, that line should have returned some interesting info.
On one of my AMD systems I got this output
bugs : tlb_mmatch fxsave_leak sysret_ss_attrs spectre_v1 spectre_v2
and on an Intel system
bugs : cpu_meltdown spectre_v1 spectre_v2
Note that I can't show the egrep highlighting here on Google Plus but you should be seeing the Meltdown/Spectre bugs highlighted.

Now, lets check for the fix and see if your CPU has been patched yet.
egrep --color -i "retpoline|kaiser" /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts nopl aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida dtherm retpoline kaiser tpr_shadow vnmi flexpriority

And there you go. The Intel system has both Meltdown and Spectre patches.
On my AMD system I get similar output, but only for Spectre (because the AMD's are only susceptible to Spectre).
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt hw_pstate rsb_ctxsw retpoline retpoline_amd npt lbrv svm_lock nrip_save vmmcall

So I would recommend that you just look at your cpuinfo for your various CPU's and see what new info is in there.
cat /proc/cpuinfo

Bonus command - Let's throw it all in there at once.
egrep --color -i "retpoline|kaiser|meltdown|spectre" /proc/cpuinfo

That will show you what bugs your CPU has and what fixes are applied.
If this command returns no output, your CPU and kernel have not been patched and you are vulnerable! In this case you need to update your system and try again. If you still get no output, you may need to do a full distro update to the newest release. If you are already running the latest version of your Linux distro and they have not patched yet, it may be time to consider switching distros.

Note: I assume most everyone out there has a CPU with at least two cores. Most of us even more. Because of this the output from most of the above commands will be repeated identically a number of times equal to the number of cores in your CPU. No biggie, just ignore all but the last entry.

Wednesday, 21 March 2018

Linux from the command line | Linux for sysadmins -- Managing your Docker containers from the command line with Dry

Linux from the command line | Linux for sysadmins -- Managing your Docker containers from the command line with Dry

A command line Docker manager is a great tool for remote management, especially over a WAN or the Internet (via VPN of course). It also eliminates the need for a full client device, letting you manage a container from many kinds of devices.
https://www.2daygeek.com/dry-an-interactive-cli-manager-for-docker-containers/

Monday, 19 March 2018

Linux from the command line -- Manage disk partitions with parted

Linux from the command line -- Manage disk partitions with parted
https://www.2daygeek.com/how-to-manage-disk-partitions-using-parted-command/

Linux from the command line -- Digging into the 'who' command

Linux from the command line -- Digging into the 'who' command

Granted there aren't as many use cases for the who command as traditional multi-user logins aren't as common as they used to be. But who is still a useful command.
https://www.tecmint.com/linux-who-command-examples/#

Linux tips & tricks -- Encrypting files from your file manager

Linux tips & tricks -- Encrypting files from your file manager

With security being a bigger issue all the time, encryption is a necessary tool. The easier it is to use, the more likely you are to use it. So here's how to setup and use encryption right from your file manager.
https://www.linux.com/learn/intro-to-linux/2018/3/how-encrypt-files-within-file-manager

Linux tips & Tricks -- taking back control of your resolve.conf

Linux tips & Tricks -- taking back control of your resolve.conf

I'm posting this as informational and mostly for reference purposes. You should really RTFM the docs and or wiki for your distro before messing with something like your resolver setup. For example, SUSE distros usually control things like this using the system administration tool, YaST2.
https://www.ctrl.blog/entry/resolvconf-tutorial

Linux tips & tricks -- create shortcuts to long paths with gogo

Linux tips & tricks -- create shortcuts to long paths with gogo

I hesitate to share this because although it's handy, it really sets you up for getting into bad habits. That said, you're all (supposedly ;') grownups so you can decide for yourself.
Mainly it's not something you want to use for generic tasks, especially for sysadmins that use multiple systems as it won't be available to you on every system. However, I know that personally I have a few specific machines that I end up cd'ing into long, deep directory paths multiple time per day and this would save some time and frustration.
https://www.tecmint.com/gogo-create-shortcuts-to-long-directory-paths-in-linux/

Sunday, 18 March 2018

Linux from the command line -- Cli.FYI

Linux from the command line -- Cli.FYI

Cli.Fyi is a potentially useful command line query tool that allows you to quickly retrieve information about emails, IP addresses, URLs and lots more either from the command line...
https://www.2daygeek.com/cli-fyi-a-tool-to-fetch-information-ips-emails-domains/

Monday, 12 March 2018

Linux tips & tricks -- Overclocking your AMD GPU

Linux tips & tricks -- Overclocking your AMD GPU
https://www.maketecheasier.com/overclock-amd-gpu-linux/

Linux from the command line -- viewing images with feh

Linux from the command line -- viewing images with feh

feh is a great way to view image files fast from the command line. Great when looking through directories, cleaning up your hard drive, etc.

Oh, and to install it on OpenSUSE, just do
zypper in feh
https://www.maketecheasier.com/feh-image-viewer/

Linux for sysadmins | Linux security -- Snort, another Intrusion Detection System (IDS) option for Linux

Linux for sysadmins | Linux security -- Snort, another Intrusion Detection System (IDS) option for Linux

There are many security tools available for Linux and like most things, the best solution for you is going to be a combination of tools that best suits the particular setup and configuration you are using it for. Snort is one of the tools to put in that mix.
https://linuxhint.com/configure-snort-ids-create-rules/

Friday, 9 March 2018

Learning Linux | Linux from the command line -- Linux Fu: regular expressions

Learning Linux | Linux from the command line -- Linux Fu: regular expressions

Hackaday has a great article series called "Linux Fu" and this is the latest in the series. You can get to the rest from the resources at the bottom of the article. Meanwhile, you can learn more about the all important regular expressions.
https://hackaday.com/2018/03/09/linux-fu-regular-expressions/

Linux from the command line | Linux tips & tricks -- move binaries safely from one machine to another with exodus

Linux from the command line | Linux tips & tricks -- move binaries safely from one machine to another with exodus

Now this is cool and handy. You know you wished you could do this before.
https://www.tecmint.com/exodus-copy-linux-binaries-to-remote-linux-system/

Thursday, 8 March 2018

Linux from the command line -- Making command line skills fun to learn

Linux from the command line -- Making command line skills fun to learn

By now everyone that follows my stream should know that I think everyone should learn and use the command line (in addition to their GUI desktop) because it's a fast and powerful part of your Operating System. That doesn't mean learning it has to be boring.
https://www.ostechnix.com/test-your-bash-skills-by-playing-command-line-games/

Linux from the command line - Make every line count with nl

Linux from the command line - Make every line count with nl


https://www.howtoforge.com/linux-nl-command/

Wednesday, 7 March 2018

Linux tips & tricks -- listing all running services in Linux

Linux tips & tricks -- listing all running services in Linux
https://www.2daygeek.com/how-to-check-all-running-services-in-linux/

Linux for sysadmins -- Configuring NFS Server Clustering with Pacemaker

Linux for sysadmins -- Configuring NFS Server Clustering with Pacemaker

Unfortunately these days a lot of younger/newer sysadmins seem to ignore NFS for some reason. This despite that fact that it's a excellent network file system with distinct advantages over other options, particularly SMB. SAMBA should really only be used for serving Windows clients.
If you have a Linux network or just Linux storage servers feeding other Linux/Unix boxes then you probably should be doing something like this setup in the article.
https://www.linuxtechi.com/configure-nfs-server-clustering-pacemaker-centos-7-rhel-7/

Tuesday, 6 March 2018

Linux tips & tricks -- installing software on Linux

Linux tips & tricks -- installing software on Linux

I hesitate to post this as every distro has a proper, preferred method of installing packages, but this is a good basic overview of the process. Just promise me that if you read this, you'll also go to your distro's website and lookup the way they want you to install packages.
https://lifehacker.com/how-to-install-software-on-linux-1822447190

Linux from the command line -- tame tasks with nice and renice

Linux from the command line -- tame tasks with nice and renice

I'm stunned by how many Linux users have never used nice or renice or haven't even heard of them. They are core commands for managing a system and understanding Linux task priority and how to manage it effectively is a critical skill.
https://www.howtoforge.com/linux-nice-command/

Linux tips & tricks - really using top

Linux tips & tricks - really using top

Sure, we've all used top, but how many of us have really used it to dig out information about a running system.
https://opensource.com/article/18/3/tips-top-monitoring-cpu-load-linux

Linux tips $ tricks | Linux for sysadmins -- restoring deleted filed with foremost

Linux tips $ tricks | Linux for sysadmins -- restoring deleted filed with foremost

We've all been there. You hit return and think "Aw crap!" you deleted the wrong file(s). Try foremost.
http://linuxtechlab.com/restore-deleted-files-linux-with-foremost/

Linux tips and tricks - Create smart partition backups with partclone

Linux tips and tricks - Create smart partition backups with partclone
https://linuxconfig.org/how-to-use-partclone-to-create-a-smart-partition-backup

Saturday, 3 March 2018

Linux administration with Ansible

Linux administration with Ansible

Ansible is a solid tool for managing Linux workstation configurations. It's especially popular with users of Linux distros that have poor or no decent built in administration tools of their own Ubuntu , though it also works nicely on other distros too making it a nice way to unify your configuration tools across a heterogeneous Linux network.

https://opensource.com/article/18/3/manage-workstation-ansible

Linux from the command line -- managing tasks with Taskwarrior

Linux from the command line -- managing tasks with Taskwarrior

Here's a command line tool for Linux task management. IE a To Do list manager.
https://www.maketecheasier.com/taskwarrior-manage-tasks-command-line/

Linux from the command line | Linux for sysadmins -- returning a string from a function in bash

Linux from the command line | Linux for sysadmins -- returning a string from a function in bash

Sometimes you need to get info from a string in or out of bash. Here's some help.
https://linuxhint.com/return-string-bash-functions/

Linux from the command line -- Using the history command

Linux from the command line -- Using the history command

The history in Linux is handy and if used properly it can be very powerful.
https://www.2daygeek.com/how-to-use-history-command-effectively-in-linux/

Linux from the command line -- finding out about that CPU with lscpu

Linux from the command line -- finding out about that CPU with lscpu

There are a whole series of really useful ls* commands.
https://www.howtoforge.com/linux-lscpu-command/

Friday, 2 March 2018

Linux tips & tricks -- lshw - What's in this box anyway?

Linux tips & tricks -- lshw - What's in this box anyway?

lshw is one of several ls prefixed hardware interrogation tools for Linux. While tools like lspci and lsusb have an obvious hardware focus, lshw is much more broad in scope and can provide an overwhelming amount of information on all of the hardware in your system.

Try this
lshw --html > ~/Documents/MyHardware.html
Then go click on the resulting file.
https://www.howtoforge.com/linux-lshw-command/