# Converting strings uppercase or lowercase in shell

**URL:** <https://linux-tips.com/t/converting-strings-uppercase-or-lowercase-in-shell/236>\
**Category:** Shell\
**Created:** [December 5, 2014, 10:55pm UTC](https://linux-tips.com/t/converting-strings-uppercase-or-lowercase-in-shell/236 "2014-12-05T22:55:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![demirten](https://linux-tips.com/user_avatar/linux-tips.com/demirten/32/64_2.png) [@demirten](https://linux-tips.com/u/demirten)\
**Post date:** [December 5, 2014, 10:55pm UTC](https://linux-tips.com/t/converting-strings-uppercase-or-lowercase-in-shell/236/1 "2014-12-05T22:55:44Z")

</div>

If you need to convert strings to uppercase in shell, you can use `tr` or `awk` command for this.

Both of works but you can choose which one easier to remember for you.

```
$ cat /etc/passwd | tr '[:lower:]' '[:upper:]'

$ cat /etc/passwd | awk {'print toupper($0)'}

```

Similarly you can convert uppercase to lowercase too.

```
$ tr '[:upper:]' '[:lower:]' < /etc/passwd

$ awk {'print tolower($0)'} /etc/passwd

```

**Note** : Look at the 3 different kind of usage: pipe, file redirection and giving filename as parameter. This is the most basic feature of Linux but deep understanding of how it works greatly improve your Linux skills.
