recent posts related to linux and unix
Linux grep commands FAQ: Can you share some Linux/Unix grep command examples?
Sure. The name grep means "general regular expression parser", but you can think of the
grep command as a "search" command for Unix and Linux systems: it's used to search for text strings and more-complicated "regular expressions" within one or more files.
I think it's easiest to learn how to use the
grep command by showing examples, so let's dive right in.
Back in the old days I thought that any pattern that was including in single-quotes with the Unix
grep command meant that the pattern inside the string was completely ignored by
grep. But these days I have to escape special characters with a backslash character, which is really annoying. This example shows what I mean:
From the URL I linked to, “fish is a fully-equipped command line shell (like bash or zsh) that is smart and user-friendly. fish supports powerful features like syntax highlighting, autosuggestions, and tab completions that just work, with nothing to learn or configure.”
I haven’t tried it yet, but from all of the images I’ve seen, Elementary OS looks like the prettiest desktop Linux distribution I’ve ever seen. I hope to install it this weekend and take it for a spin.
The URL contains a statement of the Red Hat ethos. A couple of good quotes:
Open source is a development model, not a business model. Red Hat is in the enterprise software business and is a leading provider to the Global 500. Enterprise customers need products, not projects and it’s incumbent on vendors to know the difference. Open source projects are hotbeds of innovation and thrive on constant change. These projects are where sometimes constant change happens, where the development is done.
I just saw that this is a way you can easily determine the blocksize of a filesystem, at least a Mac/Unix/Linux filesystem:
$ echo foo > foo $ du -h foo 4.0K foo
I tried to do the same thing with
touch foo, but that didn’t work. Without digging into it more, the key seems to be in having very little text in the file, at which point the
du command shows the minimum block size for the file.
Linux/Unix FAQ: Can you share some Linux
find command examples?
Sure. The Unix/Linux find command is very powerful. It can search the entire filesystem to find files and directories according to the search criteria you specify. Besides using the
find command to locate files, you can also execute other Linux commands (grep, mv, rm, etc.) on the files and directories you find, which makes find extremely powerful.
Summary: How to create a public and private key pair to use ssh and scp without using a password, which lets you automate a remote server backup process.
Over the last two years I've ended up creating a large collection of websites and web applications on a variety of Linux servers that are hosted with different companies like GoDaddy and A2 Hosting. I recently embarked on a mission to automate the backup processes for all these sites, and as a result of this effort, I thought I'd share what I've learned here.