Shell Commands


Shell Commands


Manual and Navigating file system

$ man   #user's Manual
$ clear  #clear the terminal screen
$ pwd  #retrun working directory name
$ ls  #list directory contents
$ ls folder  #list folder contents
$ ls -l  #list long format
$ ls -a  #list hidden contents
$ ls -la  #list hidden contents with long format
$ open .  #open files and directories
$ cd  #change directory
$ cd ..  #go up one level of the directory tree
$ cd ~  #go home directory
$ cd -  #go previous directory
$ find . -type file -name "*.txt"
$ find . -type file -name "*.json"
$ find . -type directory -name "*2"
$ which node  #locate a program file in the user's path

Create and Manage files

$ touch new_file.txt  #create file
$ cat new_file.txt  #print contents
$ echo "hello world"  #print "text"
$ mkdir  #make directories
$ cp file1.txt dir1/  #copy files
$ mv file1.txt dir1/  #move files
$ mv file1.txt file2.txt  #rename
$ rm file2.txt  #remove files
$ rm -r dir2  #remove folder