---
title: "Top Unix File Commands to Create, Edit, Delete, Modify"
description: "Mostly used UNIX file commands to use in your projects."
url: https://srinimf.com/2017/02/25/top-13-proven-unix-commands-absolutely-helpful-for-files/
date: 2017-02-25
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2018/07/pexels-photo-1069712-e1531062551915.jpeg?fit=1671%2C1253&ssl=1
categories: ["UNIX"]
tags: ["Create file in UNIX", "DELETE file in UNIX", "Rename file in UNIX", "Top UNIX Interview Questions"]
type: post
lang: en
---

# Top Unix File Commands to Create, Edit, Delete, Modify

I have created a list of Unix file commands that were discussed during my interview. As a result, I’ve chosen to share these commands with you.

Related[Unlock the Power of Unix: Your Ultimate Guide to Daily Commands](https://srinimf.com/2017/02/17/most-popular-daily-use-unix-commands-now/)

## Unix File Create, Edit, Modify, DELETE commands

>> vi myfile.txt

The above command useful to **create** new file.

>> rm abc.txt

The above command **deletes** specified file.

>> vi myfile.txt

The above command useful to **modify or edit** its contents.

>> mv abc.txt cde.txt

The above command useful to **Modify or Rename** a file name.

The other way when you are new to UNIX the tips given in [UNIX/Linux Operating system – Beginner to Advanced](https://goo.gl/AI862J) really give lot of benefits. Working on the files is very common practice for data warehousing developers.

## Unix File Editing Commands

$> head -1 sample.txt :=> To get top one line
$> sed ‘2,$d’ sample.txt :=> To get first 2 lines
$> tail -1 sample.txt :=> To get last one line
$> tail -n ‘2p’ sample.txt :=> To get 2nd line of file
$> head -4 sample.txt | tal -1 :=> To get fourth line of file
$> sed ‘1d’ sample.tx :=> To remove first line of file
$> sed -i ‘1d’ sample.txt :=> After deleting update the same file
$> sed -i ‘5,7d’ sample.txt :=>Remove lines from 5 to 7
$> sed -n ’35p’ sample.txt | wc -c :=>
To get 35 number of chars in any line of the file
$> cut -f4 -d ‘ ‘ ==> To get 4th word from each line of file delimiter is spaces
$> echo ‘unix’ | rev : ==> To get word in reverse – xinu
$> unzip -j sample.txt :=> To unzip a file
$> file -i file.zip :=> To get information about file

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2017%2F02%2F25%2Ftop-13-proven-unix-commands-absolutely-helpful-for-files%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2018%2F07%2Fpexels-photo-1069712-e1531062551915.jpeg%3Ffit%3D1200%252C900%26ssl%3D1&description=Top%20Unix%20File%20Commands%20to%20Create%2C%20Edit%2C%20Delete%2C%20Modify)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2017/02/25/top-13-proven-unix-commands-absolutely-helpful-for-files/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2017/02/25/top-13-proven-unix-commands-absolutely-helpful-for-files/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2017/02/25/top-13-proven-unix-commands-absolutely-helpful-for-files/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2017/02/25/top-13-proven-unix-commands-absolutely-helpful-for-files/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20Top%20Unix%20File%20Commands%20to%20Create%2C%20Edit%2C%20Delete%2C%20Modify&body=https%3A%2F%2Fsrinimf.com%2F2017%2F02%2F25%2Ftop-13-proven-unix-commands-absolutely-helpful-for-files%2F&share=email)
-

### Like this:

Like Loading…
