8 uncommon Linux instructions

0
1
8 uncommon Linux instructions



This submit examines eight considerably uncommon Linux instructions which can be price realizing. However earlier than we get into the precise instructions, you possibly can run the command under to see whether or not these eight instructions are put in in your system. For every command, you’ll see the file system location for the command executable or a line that begins with “no command in (PATH)” the place “PATH” can be a show of your search path – the locations the place the command appears for them.

[shs@fedora ~]$  for cmd in sure shuf column pv tldr stat namei rev
do
which $cmd
executed

The output ought to appear to be this if all of the instructions are put in:

usr/bin/sure
/usr/bin/shuf
/usr/bin/column
/usr/bin/pv
/usr/bin/tldr
/usr/bin/stat
/usr/bin/namei
/usr/bin/rev

Now let’s check out what every of those instructions can do for you.

1. The sure command

The sure command will repeat the phrase “sure” or no matter string you present time and again (e.g., with a command like “sure Hiya World”) till you’ve seen sufficient and use ^c to cease the output. Be forewarned that the output will fill your display extremely quick. The extra helpful facet of this command is that you should use it to reply “sure” to a script that asks a whole lot of questions. Simply run a command like this and also you received’t must kind “sure” to no matter questions it is going to ask:

$ sure | scriptname

2. The shuf command

The shuf command will randomly shuffle the traces in a file as proven within the examples under.

$ shuf workers    $ shuf workers
Sam Adams Sally Rose
Elaine Henry John Doe
Joanne Zahn Mary Berry
Mary Berry David Bloom
Lisa Stone Joanne Zahn
John Doe Sam Adams
Ben Matson Eric Docker
Eric Docker Lisa Stone
David Bloom Elaine Henry
Sally Rose Ben Matson

Shuffled output may be helpful if you want random textual content for some activity or to check a script to make it possible for its output is what you anticipate to see.

3. The column command

The column command will show textual content in columns. Listed below are two examples of use it:

$ cat workers | column
John Doe Lisa Stone Joanne Zahn Eric Docker Ben Matson
Mary Berry Elaine Henry David Bloom Sam Adams Sally Rose
$ cat workers | column -t
John Doe
Mary Berry
Lisa Stone
Elaine Henry
Joanne Zahn
David Bloom
Eric Docker
Sam Adams
Ben Matson
Sally Rose

4. The pv command

The pv (pipe viewer) command supplies a helpful method to show the progress of information being despatched via a pipe. Right here’s an instance. Notice the output shows the progress and the velocity of the command.

$ pv largefile.zip | tar xzf -
348KiB 0:00:00 [37.4MiB/s] [============> ] 18%

5. The tldr command

The tldr command supplies a simplified man web page that shows a collection of examples on use the command you’re asking about.

]$ tldr date

date

Set or show the system date.
Extra info: https://www.gnu.org/software program/coreutils/handbook/html_node/date-invocation.html.

- Show the present date utilizing the default locale's format:
date +%c

- Show the present date in UTC, utilizing the ISO 8601 format:
date --utc +%Y-%m-%dTpercentH:%M:%SpercentZ

- Show the present date as a Unix timestamp (seconds for the reason that Unix epoch):
date +%s

- Convert a date specified as a Unix timestamp to the default format:
date --date @1473305798

- Convert a given date to the Unix timestamp format:
date --date "2018-09-01 00:00" +%s --utc

- Show the present date utilizing the RFC-3339 format (YYYY-MM-DD hh:mm:ss TZ):
date --rfc-3339 s

- Set the present date utilizing the format MMDDhhmmYYYY.ss (YYYY and .ss are optionally available):
date 093023592021.59

- Show the present ISO week quantity:
date +%V

6. The stat command

The stat command supplies significantly extra particulars on a file than the lengthy file listings supplied by the “ls -l” command. These embody the dates and instances of the newest updates and accesses.

$ stat workers
File: workers
Dimension: 112 Blocks: 8 IO Block: 4096 common file
System: 0,51 Inode: 4975 Hyperlinks: 1
Entry: (0644/-rw-r--r--) Uid: ( 1001/ shs) Gid: ( 1001/ shs)
Context: unconfined_u:object_r:user_home_t:s0
Entry: 2025-04-09 13:19:11.313070260 -0400
Modify: 2025-04-09 13:19:06.317039688 -0400
Change: 2025-04-09 13:19:06.317039688 -0400
Start: 2025-04-09 13:19:06.317039688 -0400

7. The namei command

The namei command breaks a pathname into listing ranges – displaying every listing on a separate line.

$ namei -lx /usr/bin
f: /usr/bin
Dr-xr-xr-x root root /
drwxr-xr-x root root usr
dr-xr-xr-x root root bin

$ namei `pwd`
f: /dwelling/shs
d /
d dwelling
d shs

8. The rev command

The rev command reverses traces whether or not handed to the command as customary in or saved in a file.

$ echo Hiya, World! | rev
!dlroW ,olleH
$ echo Hiya, World! | rev | rev
Hiya, World!

Each 10.0s: date fedora: Wed Apr 9 14:00:42 2025

Wed Apr 9 02:00:42 PM EDT 2025

Wrap-up

Engaged on the Linux command line may be each worthwhile and enjoyable, and there’s all the time one thing new to be taught.

LEAVE A REPLY

Please enter your comment!
Please enter your name here