Showing posts with label Red Hat. Show all posts
Showing posts with label Red Hat. Show all posts

Wednesday, 22 January 2020

mv and rename Commands

I created a file called myself:
 
Red Hat > ls
Red Hat > touch myself
Red Hat > ls
myself
Red Hat >
 
I decided it should have been called yourself so I used mv to change its name:
 
Red Hat > mv myself yourself
Red Hat > ls
yourself
Red Hat >
 
Then I decided to use the rename command to call it himself instead. To do this I had to provide the part of the name I wanted to change, what I wanted to change it to and the filename to act upon (if that makes sense):
 
Red Hat > rename yourself himself yourself
Red Hat > ls
himself
Red Hat >
 
This approach is more complicated but it gives greater flexibility. To try this out I created several files with .txt suffixes:
 
Red Hat > rm *
Red Hat > touch file{1..5}.txt
Red Hat > ls
file1.txt  file2.txt  file3.txt  file4.txt  file5.txt
Red Hat >
 
I then decided to remove the suffixes and did this as follows:
 
Red Hat > rename .txt '' file*
Red Hat > ls
file1  file2  file3  file4  file5
Red Hat >

Friday, 17 January 2020

How to See the OS Version in Red Hat Linux

You can see your operating system version in Red Hat Linux as follows:

Red Hat > cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.7 (Maipo)
Red Hat >