Files & Folders

Create file

$ touch [fileName]
copy
$ echo $null >> [fileName]
copy

Delete file

$ rm [fileName]
copy

Display file content

$ cat > [filename]
copy
$ echo $null >> [filename]
copy

Edit text file

$ vi [fileName]
copy
$ nano [fileName]
copy
$ emacs [fileName]
copy
$ pico [fileName]
copy
$ ed [fileName]
copy

Copy file or folder

$ cp [fileName] [newFileName]
copy
$ cat [fileName] > [newFileName]
copy
$ dd if=[fileName] of=[newFileName]
copy

Move/Rename file or folder

$ mv [fileName] [newFileName]
copy

Create folder

$ mkdir [folderName]
copy

Delete folder

$ rm -r [folderName]
copy

List folder contents

$ ls
copy
$ dir
copy

Change folder

$ cd [path]
copy

Change to users home directory

$ cd ~
copy

Change to parent directory

$ cd ..
copy

Change to previous directory

$ cd -
copy

Show current folder

$ pwd
copy

Create a physical link to file or folder

$ ln [fileName] [linkName]
copy

Find phrase within file

$ grep [phrase] [fileName]
copy

Get filesystem of partition

$ file -sL [partition]
copy

Mount filesystem

$ mount /dev/[device] [path]
copy

Unmount filesystem

$ umount [path]
copy

Make file executable

$ chmod +x [file]
copy

Show size of all sub directories

$ du -h –max-depth=1
copy

Display and update information of files(like top)

$ watch -d -n 2 ‘ df; ls -FlAt;’
copy

List trash files

$ ls -l files ~/.local/share/Trash/files
copy
$ trash-list
copy

Empty trash

$ rm -r ~/.local/share/Trash
copy
$ gio trash --empty
copy
$ gvfs-trash --empty
copy
$ trash-empty
copy

Move file to trash

$ gio trash [file]
copy

View file permission

$ ls -l [file]
copy

Set file permission

$ chmod [permission] [file]
copy

View owner and group of file

$ ls -l [file]
copy

Change owner of file

$ chown [user] [file]
copy

Change group owner ship of file

$ chgrp [group] [file]
copy
Copied to clipboard
free 100$ digital ocean credit