Many of us sooner or later face the necessity of using Linux/Unix command line for different needs. It could be just a simple using terminal for configuring a local machine or working with a remote server. Here is a shortlist of commands which will be helpful for complete beginners, frankly saying, this is the list of commands I use on an everyday basis.
Manual
The first and the most useful command is man. Every time you need to know how to use any command just type in your command line
man <command>
This is a manual for grep command (to quit the manual page just type “q”). Usually manual contains all comprehensive information about the command and it is not always handy to read all the pages if you need a quick overview of how to use a command with an appropriate option.
I often use a tldr pages to learn a new command or refresh my knowledge of usage examples. This is a simplified, community-driven version of manual pages.
Basic commands
pwd — print the current directory path
cd — change the current working directory
mkdir <directoryname> — create a new directory in the present working directory or at the specified path
rmdir <directoryname> — delete a directory
rm <filename> — delete a file
mv <file> <new_file_path> — move file to a new location
cat <filename>-print file
ls — display the contents of a directory
One of the most popular examples of using ls command is in combination with -al. It shows all files and directories (including hidden ones) in a table format (permissions, ownership, size, and modification date).
clear — clear the screen of the terminal
touch <filename> — create an empty file(if the file already exists, it opens the file in write mode and updates its timestamp)
echo — print arguments to the terminal (or to the given file)
diff <firstfile> <secondfile>— compare files
history — show command line history
grep — a powerful tool, which can be used for searching in files for an exact string or a regular expression. It also can be combined with pipes to filter the output of another command.
grep <exact string> <filename> — search for an exact string in the file
ls -lR | grep \.java$ — show all java files
ls -lR | grep –count \.java$ — count java files
Network and Process management
ps — show the list of processes
sudo — run a command as root
kill <PID> — terminate the process by PID
killal <name_of_program> — terminate a program or process by name
ping <host>— sends packets to a network host
ssh -i <paht_to_key_file.pem> <user>@<host>— connect to remote server using ssh protocol
Note: the list was formed based on my personal experience, if you think something important is missed, don’t hesitate to drop a comment here, or just contact me on any social media.
Level Up Coding
Thanks for being a part of our community! More content in the Level Up Coding publication.
Follow: Twitter, LinkedIn, Newsletter
Level Up is transforming tech recruiting ➡️ Join our talent collective
Linux commands for everyday was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.