---
title: "Linux How to Create Custom Command with ‘alias’ Easily"
description: "Explained about how to create your own command in Linux."
url: https://srinimf.com/2020/03/24/linux-how-to-create-your-own-command/
date: 2020-03-24
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2020/03/how-to-create-your-own-command-in-linux.jpg?fit=1200%2C700&ssl=1
categories: ["Linux"]
tags: ["How to create your own command in Linux", "How to use alias command", "Ideas to Create custom command in bash linux"]
type: post
lang: en
---

# Linux How to Create Custom Command with ‘alias’ Easily

![Linux Create Custom Command Using 'alias'](https://i0.wp.com/srinimf.com/wp-content/uploads/2021/04/linux.png?resize=1080%2C608&ssl=1)

Here are the ideas on [how to](https://srinimf.com/2012/09/05/how-to-check-vsam-file-is-closed-or-not/) create custom [command in Linux](https://srinimf.com/2023/01/07/scp-command-in-linux-how-to-copy-file/) using ‘alias’

---

One of the best examples is you need to go to a directory and display the contents in the order of edit made. To achieve this you need to issue two commands. Instead of using two commands you can complete this with a single command.

## 1. How to create Custom Command

I want to go to my home directory and list the components inside of it.

```
>$ cd (home_dir)
>Srini lsdm
test1
test2
test3
```

Here, I used two commands. One is ‘**cd**‘ and another one is ‘**lsdm’**.

**The command you need to create custom command is ‘*alias*‘**

### 2. How to Use Alias

>$ *alias name=’string’*

**Let me create a new command**

```
>$ alias foo='cd (home_dir); lsdm'
```

**Now new command is created with ‘foo’.**

```
>$ foo
>$srini
test1
test2
test3
```

### 3. How to Verify the Actual Commands Behind Your Custom Command

Use ‘type’ command to verify.

```
>$type foo
foo is aliased to 'cd (home_dir); lsdm'
```

**How to nullify alias-command**. The command is ‘unalias’

```
>$ unalias foo
```

Now the ‘alias-command’ foo is no longer present. So the ‘foo’ command is not available now.

**How to search for the files and content in the Files**

**Locate **– it will search the pathname of similar to what you entered in any directory.

**Find – **you can find a particular string in a group of directories.

**Related Posts**

- [How to Sort Text Files: Linux Shell Script Ideas](https://srinimf.com/2023/08/26/how-to-sort-text-files-linux-shell-script-ideas/)DateAugust 26, 2023
- [How to Write Echo Command Correctly in Linux](https://srinimf.com/2022/12/03/how-to-write-echo-command-correctly-in-linux/)DateDecember 3, 2022
- [The Use of df (disk free) Command in Linux](https://srinimf.com/2022/04/15/the-use-of-df-disk-free-command-in-linux/)DateApril 15, 2022

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2020%2F03%2F24%2Flinux-how-to-create-your-own-command%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2020%2F03%2Fhow-to-create-your-own-command-in-linux.jpg%3Ffit%3D1200%252C700%26ssl%3D1&description=Linux%20How%20to%20Create%20Custom%20Command%20with%20%27alias%27%20Easily)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2020/03/24/linux-how-to-create-your-own-command/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2020/03/24/linux-how-to-create-your-own-command/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2020/03/24/linux-how-to-create-your-own-command/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2020/03/24/linux-how-to-create-your-own-command/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20Linux%20How%20to%20Create%20Custom%20Command%20with%20%27alias%27%20Easily&body=https%3A%2F%2Fsrinimf.com%2F2020%2F03%2F24%2Flinux-how-to-create-your-own-command%2F&share=email)
-

### Like this:

Like Loading…
