Linux/terminal

move folder, rmdir, rm -r, rm -rf ., touch, find, cat, -p

Naranjito 2021. 1. 26. 12:31
  • mv ./correlation_20201201.ipynb  /Users/joohyunyoon/workspace/DL/

I am going to move ipynb file from current folder to DL folder.

$ mv ./correlation_20201201.ipynb  /Users/joohyunyoon/workspace/DL/

mv : Move

 

  • /usr/local

It is hierarchy for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr. Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr.

 

  • /usr/local/bin

bin : Binaries, it is just a directory where a user of an operating system can expect to find applications. It is the actual executable code for your application or library. Each of these folders are further subdivided into Debug and Release folders, which simply correspond to the project's build configurations.

 

  • rmdir

Remove Directory

 

  • rm -r 

Remove -Recursive, if a directory that is not empty, it remove not only everything in the named directory, but also everything in its subdirectories. 

-r : -Recursive

$ rmdir __pycache__/
rmdir: __pycache__/: Directory not empty
>>>
$ rm -r __pycache__/
$ ls
$ 

 

  • cp -r

Copy -Recursive, is used for recursive copy of all files and directories in source directory tree.

 

  • rm -rf .

Remove Recursively Force of current folder and sub folders.

$ rm -rf .git

 

  • touch

The command to create new, empty files.

$ touch joohyun.txt

 

  • find

Find every file including '.conf' within current directory(.)

$ find . -name '*.conf'
./snmp/mib2c.int_watch.conf
./snmp/mib2c.create-dataset.conf
./snmp/mib2c.column_storage.conf
...

 

  • cat

Concatenate-combine two strings to form a single one-files and print on the standard output.

$ cat hello.py 
print('hello world')

 

  • ls -a

List All, it will enlist the whole list of the current directory including the hidden files. 

$ ls -a
.		..		.git		.gitignore	hello.py

 

  • ls -al
$ ls -al
total 6726968
drwxrwxr-x  8 neouly neouly       4096 Oct  9 02:02 . //directory
drwxr-xr-x 22 neouly neouly       4096 Oct 15 17:24 ..//directory
-rw-rw-r--  1 neouly neouly  103026380 Sep 15 23:20   //file

...

 

  • ls --help

List information about the FILEs.

 

  • mkdir -p

Create Parent directories

$ mkdir -p ./tour/package
$ cd ./tour/package/

 

pwd : Print Working Directory

${PWD} : Absolute route

docker run -dt -v $pwd:/tmp --name joohyun_python python:3.8

Share Absolute route:/tmp with python:3.8

                     ⇡host                             ⇡container

named joohyun_python

 

  • locate

Find files.

 

  • ln

Link, it creates a new directory entry (linked file) with the same modes as the original file.

$ echo 'text file #1'>file1
$ cat file1
text file #1

$ ls -l file1
-rw-r--r-- 1 jh jh 13 Nov 21 15:09 file1

$ ln file1 file3
$ ls -l file1 file3
-rw-r--r-- 2 jh jh 13 Nov 21 15:09 file1
-rw-r--r-- 2 jh jh 13 Nov 21 15:09 file3

$ ls -il file1 file3
155144 -rw-r--r-- 2 jh jh 13 Nov 21 15:09 file1
155144 -rw-r--r-- 2 jh jh 13 Nov 21 15:09 file3

 

  • ln -s

It creates Symbolic.

It created same file from mounted local files(Documents) which named to here as 'documents'.

ln -s /mnt/c/Users/YoonJoohyun/Documents documents

 

  • ls -l

It signifies the long list format. This shows a lot more information presented to the user than the standard command.

$ ls -l

total 8
lrwxrwxrwx 1 jh jh   34 Nov 21 14:25 documents -> /mnt/c/Users/YoonJoohyun/Documents
-rw-r--r-- 1 jh jh   13 Nov 21 14:59 file1
lrwxrwxrwx 1 jh jh   42 Nov  8 17:25 jupyter -> /mnt/c/Users/YoonJoohyun/Documents/Python/
drwxr-xr-x 3 jh jh 4096 Nov 21 11:53 practice

'Linux > terminal' 카테고리의 다른 글

Install pyenv-virtualenv on mac  (0) 2022.03.31
How to add new server  (0) 2022.03.31
shell, bash  (0) 2022.03.15
How to connect to the server from the client, set to alias.  (0) 2022.03.15
$, grep  (0) 2022.01.03