[Linux] Command for File

Command formPermalink

Command [option] argument1 argument2 ...

lsPermalink

  • List information about the FILEs (the current directory by default).

$ ls /var

  • Option
    • -a
    • -A
    • -F
    • -l

$ ls -l /etc

$ ls -a /etc

$ ls -al /etc

mkdirPermalink

  • Create the DIRECTORY(ies), if they do not already exist.

  • Option

    • -m
    • -p

$ mkdir dir

$ mkdir dir1 dir2 dir3

$ mkdir -p dir1/dir2

catPermalink

  • Concatenate FILE(s), or standard input, to standard output.

  • Option

    • -n
    • -b

$ cat -n file1

cpPermalink

  • Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

  • Option

    • -i
    • -f
    • -r

$ cp file dir

$ cp file1 file2 file3 dir

$ cp -r dir1 dir

mvPermalink

  • Move SOURCE(s) to DIRECTORY.

  • Option

    • -i
    • -f

$ mv file dir

$ mv file1 file2 dir1 dir

mv, cpPermalink

  • Rename file(directory)
  • Option
    • -i
    • -f

$ mv file1 file2

$ mv dir1/file1 dir2/file2

rmPermalink

  • Remove file
  • Option
    • i
    • f
    • r

$ rm file

$ rm file1 filew2 file3

$ rm -r dir1

touchPermalink

  • Make new file

$ touch file

pwd, cdPermalink

  • pwd : Print the name of the current working directory
  • cd : Change the shell working directory

$ pwd

$ cd dir

whichPermalink

  • Write the full path of COMMAND(s) to standard output.
  • Option
    • -a

ReferencePermalink

  • –help