[Linux] Command for File
Command form
Command [option] argument1 argument2 ...
ls
- 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
mkdir
-
Create the DIRECTORY(ies), if they do not already exist.
-
Option
- -m
- -p
$ mkdir dir
$ mkdir dir1 dir2 dir3
$ mkdir -p dir1/dir2
cat
-
Concatenate FILE(s), or standard input, to standard output.
-
Option
- -n
- -b
$ cat -n file1
cp
-
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
mv
-
Move SOURCE(s) to DIRECTORY.
-
Option
- -i
- -f
$ mv file dir
$ mv file1 file2 dir1 dir
mv, cp
- Rename file(directory)
- Option
- -i
- -f
$ mv file1 file2
$ mv dir1/file1 dir2/file2
rm
- Remove file
- Option
- i
- f
- r
$ rm file
$ rm file1 filew2 file3
$ rm -r dir1
touch
- Make new file
$ touch file
pwd, cd
- pwd : Print the name of the current working directory
- cd : Change the shell working directory
$ pwd
$ cd dir
which
- Write the full path of COMMAND(s) to standard output.
- Option
- -a
Reference
- –help