Programming in UNIX environment : Commands – ed, cat, ls, pr,

In UNIX environment we use a lot of commands. Some commands are explaining here.
For editing a file we use ed command.
$ed file1
no such file or…
a
Enter the text
.
w file1
q
$

When we type the command ‘ed’ and the filename, if the file does not exist, it shows a message. Type ‘a’ for appending. After adding types a ‘.’ character in the next line to indicate writing is over.Then write it into the file by typing ‘w’ and the file name.And ‘q’ to quit.
The command ‘cat’ shows the content of the file.
$cat sachin
$cat sachin num
‘pr’ instead shows the content by pages and the file name.In ‘pr -m filename’ the ‘m’ indicates the columns.
pr sachin
pr sachin num
$pr -3 sachin num
$pr -m // a set of files in parallel columns.

The ‘ls’ command lists all the files. The ls * lists all including the files in the directories.

ls DIRname
$ls *
$ls -t // list by time.
$ls -l //list by details.
$ls -lt //list by details by recent first.
$ls -u // infn abt when files were used.
$ls -ult // most recent.

Advertisement

Author: Abhilash

I'm Abhilash, a web developer who specializes in Ruby development. With years of experience working with various frameworks like Rails, Angular, Sinatra, Laravel, NodeJS, React and more, I am passionate about building robust and scalable web applications. Since 2010, I have been honing my skills and expertise in the Ruby on Rails platform. This blog is dedicated to sharing my knowledge and experience on topics related to Ruby, Ruby on Rails, and other subjects that I have worked with throughout my career. Join me on this journey to explore the exciting world of web development!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: