[LINUX] [For IT beginners] What to do when the rev command cannot be used with Git Bash

introduction

I'm using Git Bash on Windows

** "This command is not implemented!" </ Font> **

Have you ever thought? In my case, I wanted to use the command ** rev **, but I was in trouble because it wasn't implemented in Git Bash.

I didn't understand what kind of package or library ** rev ** was in in the first place because I couldn't understand what was difficult even if I looked it up on the net. .. .. (By the way, ** Chocolatey ** seems to be useful, but I gave up because I couldn't implement it well ...)

How to deal with it

As a result of investigating while worrying about various things

"The rev command is implemented in busybox"

I noticed that. rev command.png Quote: No installation required! Use Linux commands on Windows

** busybox ** is like ** Git Bash's relatives (or rivals?) **, and like Git Bash, it's software for implementing Linux on Windows. I'll leave the details to the link below, but it's very easy to install!

So the conclusion I came to is

"You only have to use busybox when you want to use rev" </ font>

about it. And if you use the file after executing ** rev ** with Git Bash again, everything will be solved! The procedure is specifically introduced below!

Specific procedure

①. First, follow the steps in the following article to install busybox on your PC </ font>.

[For IT beginners] Make busybox available on Windows

If you have successfully "added system environment variables" ** [[Step 2](# -Go to the directory containing the data you want to rev on the command prompt)] ** (← You can jump with the link) Please proceed to.

If adding system environment variables doesn't work, If you just use it in time for the time being, there is no problem up to the previous step. In that case, let's work in the newly generated ** busybox ** in the PC now. In this case, proceed to ** [[Step 2'](# 2-Move the data you want to rev into the busybox folder you just created manually)] **.


②. Move to the directory containing rev data </ font> (on the command prompt)

Next, on the command prompt, use ** cd ** to change to the directory ** (folder) that contains the ** rev data </ font>.

To do this, first use the ** pwd ** command in Git Bash to identify the directory where the ** rev data </ font> is located **.

rev command11.png

Once you know where it is, open a ** command prompt ** and ** cd to that directory **. Now you are ready to ** rev ** </ font>. [[Go to step ③](#-execute rev on the target file)]

rev command12.png


③. Execute rev </ font> on the target file

At this point, all you have to do is ** rev command </ font> **. You should be able to confirm that Git Bash is doing well.

In the figure below, the text file ** want_to_rev.txt ** is reved and output to ** run_rev.txt **. The above is the remedy. Thank you for your hard work![[For commands other than rev](For commands other than #rev)] [Conclusion]

rev command13.png

(Extra edition) When "Adding system environment variables" does not work

If you did not succeed in ** adding system environment variables ** in step 1, proceed with this step.

2'. Next, move the rev data you want to rev </ font> into the busybox folder </ font> you just created. (By hand)

rev command2.png

This time, I would like to ** rev ** the contents of the text file ** want_to_rev.txt **. The contents of the file are as shown in the image.

To move a file, you first have to figure out where it is on your PC, so type pwd on the Git Bash screen to find the location of the file.

In this case, ** / c / Users / microsoft / test_directory ** was output, so ** want_to_rev.txt in "** test_directory " folder in " microsoft " folder in " user " folder in " C: **" ** I found that there is a file.

Move this file into the (should) ** busybox ** folder that you already located in the previous step and you're ready to go. (Please move manually)


3'. When you're done, it's time to run the rev command </ font>.

First, launch ** Command Prompt ** and use cd busybox to move to the ** busybox ** folder.

If you execute ls here, you can see that the data you want to ** rev ** (** want_to_rev.txt **) is in the ** busybox ** folder. rev command3.png

If you can confirm the existence of the file, File name before rev> File name after rev If so, ** rev ** files will be generated in the ** busybox ** folder.

This time, rev want_to_rev.txt> run_rev.txt You can see that a new ** run_rev.txt ** has been created in the ** busybox ** folder by running.

rev command4.png


4'. Finally, move this generated file </ font> back to the original folder and you're done </ font>.

If you actually compare the files before and after ** rev ** on Git Bash, you should be able to confirm that ** rev ** is done properly.

rev command5.png

The above is the workaround when there is no ** rev ** command. Thank you for your hard work!

Regarding commands other than rev

Finally, I tried to find out how many commands other than ** rev ** can be solved by substituting ** busybox **.

The commands that can be used in busybox are busybox, the commands that can be used in Git Bash are obtained with ls / bin, and the commands that can not be used in Git Bash but can be used in ** busybox ** are listed.

Of the 153 types of commands that can be used with ** busybox **, ** 50 types of commands (excluding busybox) correspond to them, so I will list them! If you have any other commands that you are having trouble using, please refer to them! (I haven't used any commands at all. Lol)

[[ ar ash cal cpio
dc dpkg dpkg-deb ed fsync
ftpget ftpput hd hexdump httpd
inotifyd ipcalc killall lzcat lzma
lzop lzopcat man nc pgrep
pidof pipe_progress pkill rev rpm
rpm2cpio sha3sum sha512sum ssl_client strings
su time ts ttysize unlzma
unlzop unxz usleep uudecode uuencode
watch wget whois xz xzcat

Finally

That is all for this article. How was that? This is a first aid measure for the time being, but I hope it helps.

If you find a simpler and more versatile method (such as how to implement chocolatey), I would like to introduce it again!

Recommended Posts