Showing posts with label CommandLine. Show all posts
Showing posts with label CommandLine. Show all posts

Saturday, 29 April 2017

Learning Linux - Mastering the Command Line: Comparisons in Bash

Learning Linux - Mastering the Command Line: Comparisons in Bash

At some point in your Linux journey you'll start creating shell scripts, and at some point in that process you'll find it necessary to perform logical comparisons. Is this bigger than that? Is that the same as this? And so on. Here's a tutorial to get you started.

#Linux #CommandLine #Sysadmin
http://www.linuxtechi.com/compare-numbers-strings-files-in-bash-script/

Thursday, 3 November 2016

Linux Tips & Tricks - Mastering the command line - SED

Linux Tips & Tricks - Mastering the command line - SED

Manipulating text in files is a common daily task for any sysadmin and learning to use the powerful tools available to do this can make an administrator's life vastly easier.
One of the most common and powerful tools for doing this is 'sed'.

Here's a sed tutorial to get you started.

Also note that sed has a partner 'awk' that is equally powerful in different ways. The two are often learned and used together.

To learn more about sed and awk, check out:
http://www.theunixschool.com/p/awk-sed.html
https://quickleft.com/blog/command-line-tutorials-sed-awk/
http://docstore.mik.ua/orelly/unix/sedawk/

#Linux   #Sysadmin   #CommandLine  
http://www.tecmint.com/linux-sed-command-tips-tricks/

Tuesday, 4 October 2016

Using Network Manager from the command line

Using Network Manager from the command line

In recent years Linux has been under major assault from a young generation of Apple using, form over function loving, change for the sake of change making kiddies that have attention spans too short to bother to learn how to properly use Linux, never mind how and why things were done the way they were done on Linux and UNIX.
This led to such ridiculous situations as many Linux distros switching to Network Manager for network configuration, even before it could fully perform all of the functions of the systems it replaced. Worst of all there was, for a looong time, no way to configure it from the command line. Making it useless for any serious applications requiring for example, headless operation, remote shell administration, scripted operation, etc. Finally this was rectified with the introduction of nmcli. Though nmcli eventually offered full command line configuration functionality, it seems to have been made intentionally obtuse in it's operation and syntax, as if to punish you for wanting to use the command line instead of a GUI.
For those of you that learned Linux in recent years, under the anti CLI mentality that's become so pervasive, you may by now be advanced enough to want or need to do things from the command line anyway. Here's an article to get you started on using nmcli. Good luck and keep learning the command line.

#Linux   #NetworkManager   #CommandLine   #SysAdmin  
http://www.tecmint.com/configure-network-connections-using-nmcli-tool-in-linux/

Monday, 22 August 2016

Linux Tips & Tricks - Bash shell pitfalls

Linux Tips & Tricks - Bash shell pitfalls

In my ongoing quest to get people to either start using the command line, or use it more effectively, here's a great little resource for using the most common Linux command shell.

#sysadmin #Linux #CommandLine #bash

Via Carlos F. Lange​
http://mywiki.wooledge.org/BashPitfalls

Monday, 25 July 2016

Split terminal windows with Terminator for Linux

Split terminal windows with Terminator for Linux

While I personally prefer a tabbed style terminal emulator, I can see the appeal of this setup, especially if you live in the CLI.

NOTE to OpenSUSE users
If you are using Leap 42.1 or higher, ignore the instructions at the link and just type "zypper in terminator" from a root shell, or find the terminator package in YaST2's software manager.

#Linux   #CommandLine  
http://www.linuxandubuntu.com/home/terminator-a-linux-terminal-emulator-with-multiple-terminals-in-one-window

Thursday, 19 May 2016

One Linux tool to extract them all - DTRX

One Linux tool to extract them all - DTRX

I've been using dtrx for a long time now and it's invaluable when you just want to quickly extract an archive without dealing with the particular archive type and it's associated tools and options. It's also great in scripts, eliminating the need for complex archive type checking and multiple binary dependencies.

OpenSUSE Leap 42.1 users can install as follows:
From a root shell
zypper ar http://download.opensuse.org/repositories/Archiving/openSUSE_Leap_42.1/Archiving.repo
zypper in dtrx
Press 'a' to accept the new repo key
Press 'y' to install dtrx and dependencies


#Linux   #CommandLine  
http://www.tecmint.com/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux/

Sunday, 8 May 2016

Linux Tips & Tricks - Command Line school

Linux Tips & Tricks - Command Line school

For those of you old enough to remember the old phone company ads, it's time to "reach out and touch" someone. Or in this case, some files.
The touch command is another command that must be in your bag of sysadmin and user skills. While it seems like a simplistic command of little practical use, in reality it is a very powerful and useful tool.

Note: If you use an SSD with Linux, you may find touch even more useful given many distributions now disable the at-time function on SSD drives. Even if you use the preferred option of using relatime
instead of noatime in your SSD mounts, you wont have accurate at-time information for files on that drive. This can lead to circumstances where applications, scripts, or system functions may fail. In these circumstances, any kludge of a workaround will likely involve the touch command.

#Linux   #Sysadmin   #CommandLIne  
http://www.binarytides.com/linux-touch-command/

Monday, 2 May 2016

Got a bunch of Linux boxen you're administering?

Got a bunch of Linux boxen you're administering?
Make life easier with DSH

DSH, or Distributed Shell, let's you handle multiple systems at once. Handy stuff.

#Linux   #SysAdmin   #CommandLine  
http://www.tecmint.com/using-dsh-distributed-shell-to-run-linux-commands-across-multiple-machines/

Linux tips and tricks - Managing your $PATH

Linux tips and tricks - Managing your $PATH

As you progress as a Linux user, expand your command line skills, and take on more complex tasks, eventually you will cross paths with $PATH (see what I did there? ;')
In fact this is true on most operating systems. The system path determines where the system looks for commands you enter. This is handy when you add new applications to the system. 
Here's a basic overview of checking and changing your $PATH to suit your needs. Be careful though. This has the potential to break your system or allow malware to break free of the standard Linux security restrictions so check into and understand any changes you make here before you make them. Also note that order matters. The system checks the path locations in the order they appear in the $PATH variable. This can cause system binaries to replaced by other binaries and break functionality etc.

#Linux   #CommandLine   #BASH   #SysAdmin  
http://www.tecmint.com/set-path-variable-linux-permanently/

Sunday, 10 April 2016

Linux Tips & Tricks - Using "cat" and "tac"

Linux Tips & Tricks - Using "cat" and "tac"

More tools for your command line arsenal. 
"cat" is one of those core command line tools you should learn to master. "tac" is a handy companion tool.

#Linux   #SysAdmin   #CommandLine  
http://www.tecmint.com/learn-linux-cat-command-and-tac-command/

Wednesday, 24 February 2016

Linux file permissions - Understanding Sticky Bits

Linux file permissions - Understanding Sticky Bits

For users coming from less advanced Operating Systems, the file permissions system on Linux/UNIX can be quite confusing. This article explains one of the more confusing aspects, that of "Sticky Bits". 
The article also links to other articles that explain the basics of file permissions so check those out first if you need to catch up.

#Linux   #CommandLine   #CLI  
http://www.linuxnix.com/sticky-bit-set-linux/

Friday, 2 October 2015

Linux Tips - Using dd the painless way

Linux Tips - Using dd the painless way

Recently I watched someone cussing out dd for it's utter lack of feedback. For anyone that uses dd you know what they mean. Copying devices with dd can take a long time and it gives you absolutely no indication of what it's doing. Often new users will think it's broken or has crashed and even us old-timers wonder some times. Well here's how I've been solving that problem for years now and I'll never go back to using plain dd again.
The solution is to use Pipe Viewer which is invoked with "pv".
Many systems have it installed by default, if not, install it. It's well worth it. Anyway, here's how I use it.

Say you're copying a disk image, "SomeHugeImageFile.img" onto a USB stick at /dev/sdc. Type the following at your command prompt.

pv -tpreb ./SomeHugeImageFile.img | dd of=/dev/sdc bs=4M

This command will dump SomeHugeImage.img to the raw device sdc and give you a nice status output with a bar graph, elapsed time, and eta all displayed during the process. I always follow any dd commands with "sync" to make sure all the disk buffers are flushed to disk.

Oh, and FYI. Here's the man page for pv.
http://linux.die.net/man/1/pv

#Linux   #Sysadmin   #CommandLine   #Tips