cli

20+ Unix/Linux find command examples

Linux/Unix FAQ: Can you share some 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. 

Unix/Linux grep command examples

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.

A collection of 75+ free Linux tutorials

Free Unix and Linux tutorials: Wow, this blog post makes me feel a little old. As I've been working on reorganizing the website lately, I found that I've written more than seventy-five Unix and Linux tutorials. To try to make them easier to find, I created this page to link most of them up.

So, to that end, here is a list of at least 75 free Unix and Linux tutorials I've written. I hope you enjoy them, and I hope they're helpful.

Use zgrep to grep a gzip (gz) file

Linux zgrep FAQ: How do I use the Linux zgrep command? (Or, How do I grep a GZ file?)

Linux users quickly learn how to use the Linux grep command on plain text files, but it takes a little longer to really you can grep gzip (gz) files as well. Here's how.

Problem - Want to grep gzip files

You want to grep a text file that has been compressed with gzip. You typically use the following steps to grep a gzip'd file, but you know there must be a better way:

A cool way to sort the Linux ps command by memory use

With this site hosted on a virtual server, I'm fighting quite a battle over memory use with the new LAMP architecture in place. As I try to learn more about which applications are using the most memory, I ran into this cool ps command last night that sorts the ps output by memory use, specifically by the rss field:

ps aux --sort:rss

Here's the important output from that command:

Linux sort command examples

Linux sort command FAQ: Can you share some examples of the Unix/Linux sort command?

As its name implies, the Unix/Linux sort command lets you sort text information. This article shares several examples of the Linux sort command.

Sorting ls command output

You can use the Linux sort command to sort all kinds of output from other commands. For instance, here's an example where I sort the output of the ls -al command:

grep reverse - how to reverse the meaning of a grep search

Problem

You need to reverse the meaning of a search you're performing with the grep command. For instance, you've been searching for pepperoni pizza orders like this:

grep pepperoni pizza-orders.txt

and now you need to find all orders that don't have pepperoni.

Solution

Just add the -v switch to your grep search command, like this:

What is the command to change my Glassfish admin password?

Question: What is the command to change my Glassfish admin (administrator) password?

Answer: You can change the Glassfish admin password with this asadmin command:

asadmin change-admin-password

The Glassfish master password

Note that you can also change the Glassfish master password with this command:

asadmin change-master-password

 

What is the command to start a Glassfish server?

Question: What is the command to start a Glassfish server?

Answer: I use the following command to start my Glassfish server:

asadmin start-domain domain1

Although this command refers to starting domain1, at least in my case, it also serves to start the entire Glassfish server. I don't know how this works for multiple domains, but my guess is that if you start any one of your domains, you will start up your Glassfish server.

A Glassfish command reference (cheat sheet)

Here's a copy of a Glassfish cheat sheet (reference page) that I always keep near me whenever I'm working with a Glassfish server. I like a lot of things about Glassfish, but trying to remember all of these commands for the Glassfish CLI is not one of my favorite things.

Here's my Glassfish command reference:

Syndicate content