TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Linux commands

Common File Commands in Linux

Introduction

In this post, we will learn some commonly File commands on Linux operating system.  We can use these commands in the bash terminal or in bash scripts.

Create Directory

mkdir command is used to create a directory in Linux. To create a directory called ubuntu, type the following command in the terminal window:

$ mkdir ubuntu

The new directory would be created under the present working directory. To navigate we can use the cd command.

 

Remove Directory

rmdir command is used for removing the directory.

:~$ rmdir ubuntu

Common errors while using this command is: providing a non-existent directory name or trying to remove a directory that is not empty.

Create File

There are so many ways to create a file in Linux. Using touch command, cat command, etc.

touch command creates a new file if it doesn’t exist in the directory. If the file already exists then it will change the modification timestamp of the file. To learn more about touch command use

$ man touch

To create a new file with touch, use the following command:

$ touch sample.txt

Copy File

cp command is used in Linux to copy the file. This command copies the file to the new location.

Format of the command is

cp  file <new location>

$ cp toBecopied.txt ubuntu/

Move File

mv command can be used to move the file to a new location.

Remove File

We can use the rm command to remove a file.

$ rm -rf sample.txt

To know the flags and to learn more about the command, use the below command:

$ man rm

—

Linux Commands

Linux Basic Commands Tutorial page:

https://www.testingdocs.com/linux-basic-commands-tutorial/

More Information on Ubuntu Linux:
https://ubuntu.com/

Related Posts

sudo auth log entry

Linux commands /

sudo Linux Command with Examples

su linux command

Linux commands /

su Linux Command

ls linux command

Linux commands /

ls Linux Command with Examples

touch create file

Linux commands /

touch Linux Command

change directory Linux

Linux commands /

cd(Change Directory) Linux Command with Examples

‹ su Linux Command› sudo Linux Command with Examples

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version