I was able to create ~/doc, but I don't know how to add the file.txt directory to it.

Asked 1 years ago, Updated 1 years ago, 458 views

How do I make ~/doc/file.txt?

unix

2023-01-10 09:42

1 Answers

If you're working from the command line (shell),

  • The command to create the directory is mkdir
  • The command to create the file is touch (or any editor)

I should be in the home directory ~ right after I log in, so

$mkdir doc
$ touch doc/file.txt# 0 byte file created
$ You can start the vidoc/file.txt# editor and write whatever you want.

You may want to move the current directory before you operate it

$mkdir doc
$ cd doc
$ file.txt

vi (or any other editor) Find out how to use it yourself (you can ask a different question)


2023-01-10 10:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.