Linux command line basics, part 1
There is no better way to learn Linux than by immersing oneself in the operating system itself. To achieve this, I installed Ubuntu on my wife’s old notebook and connected it to my second monitor. This allowed me to alternate between using my MacBook with two monitors and the Ubuntu system, providing me with a valuable hands-on learning experience.
Additionally, I enrolled in a Linux class, although I found myself spending most of the class time experimenting with Ubuntu. The class did offer one crucial benefit – access to a remote server. While Linux can be utilized on desktops, it is primarily designed for servers. If you lack access to a remote server, Cloudron is a great starting point.
Useful Linux commands:
ls– This is the command to list all the files in a directory.ls -a– The-aoption lists all files, including hidden ones.ls -l filename.txt– This is like showing details in Finder.file– This awesome command will identify a file type.file ls– This will tell you that “ls” is a 64-bit Linux standard binary.cd– This will take you back to your home directory.cd ..– This will take you up one directory.cd /– This will take you to the root directory. A path that starts with/, such as/bin, is an absolute path.cd $HOME/marklar– This interesting command unwraps the variable$HOMEand appends it.pwd– This displays the full path name, fully qualified path name, or absolute pathname.echo $HOME– This displays the full path of your home directory.which– This will tell you the location of a system command. Commands could be stored in many places, like/etc,/bin,/usr/bin,/usr/local/bin, and/sbin(system admin commands) are all standard locations.cal– This displays a calendar.man man– This shows the manual page for the command calledman.man cal– This tells you how to usecal.man -k pwd– This shows all the differentmanpages aboutpwd.man 2 pwd– This gives you an alternatemanpage.- Redirection. You can use this symbol (without quotes) to populate a file with data:
>. For example,uname > marklar.txtputsunameoutput text into themarklar.txtfile. vi– This gets its own post, but useESC :q!to exit.head filename– This will display the first 10 lines of a file.tail filename filename– This will display the last 10 lines of both files.cat– This command is short for “concatenate,” so originally it would combine two files.cat file1 file2 > destination_file– This combines both of these files into one.cat file1– This just prints the contents of that file to the screen.pbcopy– On macOS, this copies the output to the clipboard.
After learning about these Linux commands, you are on your way to becoming a Linux expert. Best of luck on your journey. I hope these commands give you a solid starting point.