Differences
This shows you the differences between two versions of the page.
linux_wiki:create_delete_copy_and_move_files_and_directories [2016/02/28 22:56] billdozor created |
linux_wiki:create_delete_copy_and_move_files_and_directories [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Create Delete Copy And Move Files And Directories ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | About this page/ | ||
- | |||
- | ---- | ||
- | |||
- | Create new file " | ||
- | <code bash> | ||
- | touch file1 | ||
- | </ | ||
- | |||
- | Create three files | ||
- | <code bash> | ||
- | touch {file1, | ||
- | </ | ||
- | |||
- | Create new directory | ||
- | <code bash> | ||
- | mkdir dir1 | ||
- | </ | ||
- | |||
- | Rename file or directory | ||
- | <code bash> | ||
- | mv dir1 newdir | ||
- | </ | ||
- | * Renames " | ||
- | |||
- | Create new directory tree | ||
- | <code bash> | ||
- | mkdir -p newdir/ | ||
- | </ | ||
- | * Creates newdir, dir1, dir2, and dir3 in that structure | ||
- | * -p => Make parent directories if needed | ||
- | |||
- | View directory structure in tree outline | ||
- | <code bash> | ||
- | ~$ tree | ||
- | . | ||
- | ├── anaconda-ks.cfg | ||
- | ├── file1 | ||
- | ├── newdir | ||
- | │ | ||
- | │ | ||
- | │ | ||
- | ├── newfile | ||
- | ├── otherdir | ||
- | </ | ||
- | |||
- | Remove empty directory | ||
- | <code bash> | ||
- | rmdir dir1 | ||
- | </ | ||
- | |||
- | Remove directory recursively | ||
- | <code bash> | ||
- | rm -rf dir1 | ||
- | </ | ||
- | * -r => recursively | ||
- | * -f => force, do not prompt for confirmation | ||
- | |||
- | Copy file2 into dir2 | ||
- | <code bash> | ||
- | cp file2 dir2/ | ||
- | </ | ||
- | |||
- | Copy directory dir2 and its contents into newdir | ||
- | <code bash> | ||
- | cp -r dir2 / | ||
- | </ | ||
- | * -r => recursively | ||
- | |||
- | Move file1 into dir1 | ||
- | <code bash> | ||
- | mv file1 dir1/ | ||
- | </ | ||
- | |||
- | ---- | ||