I'm in and out of server boxes all day using terminals and screen sessions. Making edits to files, setting up cron jobs, creating docker containers and monitoring data pipelines. Below are the top 5 commands I use every day.
Navigate to a directory
Navigate back a directory relative to your current path. If current path is
cd ..will bring you to
ls -ls -h
- List all contents in current path.
lsexecuted while on path
├── MyDirectory │ ├── main.py │ └── profile_pic.jpg └── creds.txt
- List all contents and it's attributes in current path AND in human-readable (
main.pyis 903 bytes in size using
ls -ls -h
-rw-rw-r-- 1 adam adam 0 Dec 20 09:49 creds.txt -rw-rw-r-- 1 adam adam 903 Dec 20 09:49 main.py -rw-rw-r-- 1 adam adam 0 Dec 20 09:49 profile_pic.jpg
- Prints the full name of the path in the current working directory.
MyDirectorywould hypothetically print
- nano is a terminal file editor, nano does not always come pre-installed with every flavor of Linux. To create and start to edit a brand new text file:
nano main.pywill create a file called main.py and bring you right into the text editor.
Copy a single file.
cp <source> <destinationpath_and_filename>
main.pyand place it in the same directory
cp main.py main_copy.py
main.pyto a new directory, first create the directory
mkdir NewFolderand copy main into it