Linux Commands Flashcards
cat
Print content of file
pwd
Print working directory.
Show path to where you are.
ls
List directory contents
cp
Copy file
mv
Rename file
mv dir/file dir2/file
Move file
rm
Delete (remove) file
cd $HOME
Change to home directory
ls -alrth myfile
List metadata
touch myfile
Create a new file named myfile
echo blahblah»_space; myfile
Append “blahblah” to myfile
rmdir mydir
Remove directory (if empty)
rmdir -rf mydir
Delete directory and everything in it
alias xx = ‘some command’
Create shortcut for a command
mkdir mydir
Create a directory
$ echo $PATH
Show a colon delimited list of directories the OS will look for programs in.
E.g.: /usr/local/bin:/usr/sbin
$ env
Show the environment variables like $PATH, $LANG, $HOME, $USER, etc.
Three ways to change to the home directory
cd
cd ~
cd $HOME
which git
Shows the path in which git will be called from
which -a git
Shows all paths in which git is installed
scp source destination
Secure Copy file from one place to another