Archive for Mastering The Command Line
I recently tutored a friend in C coding. Since I hadn’t worked with C in at least 8 years, I really needed to have some references to rely on for syntax and other specifics. Fortunately, there are some easy man pages that can be installed in Ubuntu that offer helpful information that I was able to use to help refresh my memory.
These man pages are easily installed by installing the manpages-dev package. You can install this package via Synaptic or directly on the command line. I like the command line method personally, so I ran sudo apt-get install manpages-dev from the command line to quickly install the package.
After installing the package, I’m able to access man pages for functions such as printf, opendir, and putc. For each function, it shows the valid syntax as well as what library is required to make use of the function.
The information isn’t limited to functions as you can also access information on the libraries, such as stdio or string.
To access any of this information, simply run man [function or library name] such as man stdio.
This package isn’t limited to C functions/libraries. It is a general use Linux development suite of man pages. For a full list of what is installed, check out the file list.
All of the WordPress themes that I work on for iThemes are managed as Git repositories. Recently, we moved past the 100 repositories mark. That’s a lot of repositories to manage, and unfortunately, too many of those repositories contain duplicated information.
Later on, I might delve into how we use Git to manage our theme repos. For today, however, I’d like to focus on how I quickly and easily pushed up changes to more than a dozen repos in a single, albeit long, Bash command.
I had finished making updates to 16 Flexx repos, and I needed to push all of those changes up. Since I had multiple working repos in that folder, I was lucky that each of these repos began with the text “Flexx”. Also, since they are all part of the same series and need to keep the same version number, that simplified the tagging as all could be tagged as 2.5.0.
Given this information, I simply ran the following command from the directory that contained all the repository directories:
There’s a lot going on here, so I’ll break it up and explain what I’m doing.
Continue reading “Updating Multiple Git Repositories Easily Using Bash for Loop”
I’ve had a lot of fun recently posting about how to do stuff on the command line in Linux. My focus is specifically for Ubuntu users, but the information and techniques can be used for any Linux distro.
Since I’m probably going to end up with a lot of content under this topic, I’ve decided to create a dedicated tag: Mastering the Command Line. I’ve gone through my older posts on this topic and tagged them as well. So, make sure to check out Mastering the Command Line if you want to know how to become a command line power user.
Back to today’s topic. You’re starting to learn how to use the command line, but it’s annoying to always have to type in similar commands over and over. If only there were a way to pull up commands that you’ve already run to run again as is or to quickly modify. Today, I’m going to teach you how to do exactly this.
Have you ever seen a bunch of ^M characters in a text file? This odd character at the end of a line can also be represented as a Ctrl+M or <CTRL>M. You don’t know what it is, and you want it to go away.
Today, I’ll help you understand what that odd ^M character is, why it is in some of your documents, and how to get rid of them.
Continue reading “Convert DOS-Formatted Files to Unix-Format in Ubuntu and CentOS”
Did you know that you aren’t limited to working on one thing at a time while on a Linux command line? You can actually “minimize” a program that you are in, get back to the command line, and then return to the program whenever you’d like.
When you run a program or script on the Linux command line (from now on referred to as the shell), you are creating a new job. For those that are used to GUI environments, each of these jobs is somewhat like a window on the desktop. Just as you can have multiple windows and switch between them, the shell is capable of managing multiple jobs and allows you to switch between them.
There is a lot to cover, so let’s start simple by describing what states a shell job can be in.
Continue reading “Multitasking from the Linux Command Line + Process Prioritization”
Many of you fellow Ubuntu users will be familiar with the “Search for Files” tool that allows you to look for files. As is true with most things in Linux, there are great desktop tools, but more power can be found in Terminal than any streamlined desktop tool can match.
Today, I’d like to introduce you to a few tools that can turn a chore of finding files into an easy process.
Continue reading “4 Great Tools to Find Files Quickly in Ubuntu”
You just got your new CentOS dedicated server, and you notice that times in your logs aren’t quite right. You check the time from the command line (run “date”), and find that the timezone is set to US Eastern or some other timezone. How do you get this changed?
Unfortunately, this is not an easy thing to figure out. Fortunately though, it’s not hard to do with the right directions.
In many of my Tips ‘n Tricks or tutorial posts, I have commands that involve editing/creating files in Vi. For those that have never used Vi, it can be a daunting experience trying Vi for the first time.
There are many holy wars fought over the best editor to use from the *nix command line. I won’t claim that Vi is the best; rather, Vi is simply what I’m used to, it’s powerful, and it is always available on servers that I work on.
In order to best help those that don’t know how to use Vi but are interested in learning, this will serve as a very brief tutorial on how to get started.
Here’s a quick tip that will help you work with multiple zip files on the command line.
If you are in a folder and have three zip files in it (a.zip, b.zip, c.zip) that you want to unzip, “no problem,” you think, “I can take care of that with one command.” So, you quickly run the following:
However, rather than having the unzip program nicely unzip each file one after another, you receive the following:
caution: filename not matched: b.zip
caution: filename not matched: c.zip
I’m sure that this is not what you were expecting. I know I certainly wasn’t expecting this when I first tried it. However, this problem can help us understand more of how the command line works.
Continue reading “Unzip Multiple Files from Linux Command Line”
I touched on this topic in my First Day with Ubuntu at the Office post under Accessing Remove File Systems; however, I thought that this deserved its own topic.
For those that don’t know SSH stands for Secure SHell. In very non-technical terms, SSH allows you to access a system running a SSH server over a network. This other system can be another computer in your home or a remote system on the other side of the planet. SSH will allow you to connect to that other system and communicate with it securely. All the data passed back and forth is encrypted, so you don’t have to worry about people sniffing your passwords or valuable data.
You may be asking what all of that means to you. What it means is that you can connect to and control a computer that is somewhere else with the computer that is sitting right in front of you. If you have a remote webserver running Linux, SSH will let you install software, edit files, change the server configuration, access the database, and more. Did you forget a file on your computer at home? No problem, just SSH into your home computer and send the file to your email account or copy it directly to your office computer.
Hopefully those quick examples of what you can do is enough to whet your appetite.










