Easy Tutorial
❮ Linux Comm Mattrib Linux Comm Mkinitrd ❯

Linux tr Command

Linux Command Manual

The Linux tr command is used to translate or delete characters in a file.

The tr command reads data from the standard input device, translates the character strings, and outputs the results to the standard output device.

Syntax

tr [-cdst][--help][--version][FIRST_SET][SECOND_SET]  
tr [OPTION]…SET1[SET2]

Parameter Description:

Character set ranges:

Example

To convert all lowercase letters to uppercase in the file testfile, you can use the following command:

cat testfile | tr a-z A-Z

The content of the testfile is as follows:

$ cat testfile         # Original content of testfile  
Linux networks are becoming more and more common, 
but security is often an overlooked  
issue. Unfortunately, in today’s environment all networks 
are potential hacker targets,  
from tp-secret military research networks to small home LANs.  
Linux Network Security focuses on securing Linux in a 
networked environment, where the  
security of the entire network needs to be considered
rather than just isolated machines.  
It uses a mix of theory and practical techniques to 
teach administrators how to install and  
use security applications, as well as how the 
applications work and why they are necessary.

After using the tr command for case conversion, the output is as follows:

$ cat testfile | tr a-z A-Z # Converted output  
LINUX NETWORKS ARE BECOMING MORE AND MORE COMMON, BUT SECURITY IS OFTEN AN OVERLOOKED  
ISSUE. UNFORTUNATELY, IN TODAY’S ENVIRONMENT ALL NETWORKS ARE POTENTIAL HACKER TARGETS,  
FROM TP-SECRET MILITARY RESEARCH NETWORKS TO SMALL HOME LANS.  
LINUX NETWORK SECURITY FOCUSES ON SECURING LINUX IN A NETWORKED ENVIRONMENT, WHERE THE  
SECURITY OF THE ENTIRE NETWORK NEEDS TO BE CONSIDERED RATHER THAN JUST ISOLATED MACHINES.  
IT USES A MIX OF THEORY AND PRACTICAL TECHNIQUES TO TEACH ADMINISTRATORS HOW TO INSTALL AND  
USE SECURITY APPLICATIONS, AS WELL AS HOW THE APPLICATIONS WORK AND WHY THEY ARE NECESSARY.

ISSUE. UNFORTUNATELY, IN TODAY'S ENVIRONMENT ALL NETWORKS ARE POTENTIAL HACKER TARGETS, FROM TP-SECRET MILITARY RESEARCH NETWORKS TO SMALL HOME LANS. LINUX NETWORK SECURITY FOCUSES ON SECURING LINUX IN A NETWORKED ENVIRONMENT, WHERE THE SECURITY OF THE ENTIRE NETWORK NEEDS TO BE CONSIDERED RATHER THAN JUST ISOLATED MACHINES. IT USES A MIX OF THEORY AND PRACTICAL TECHNIQUES TO TEACH ADMINISTRATORS HOW TO INSTALL AND USE SECURITY APPLICATIONS, AS WELL AS HOW THE APPLICATIONS WORK AND WHY THEY ARE NECESSARY.

❮ Linux Comm Mattrib Linux Comm Mkinitrd ❯