To use Linux nowadays, you don't have to touch the command line to get going. This may be true. However, I still find it important that newbies and those who are still planning to use Linux should know some of the basic commands and keyboard shortcuts to make the most out of their Linux desktop and to start having a good time.
So here I made a list of 8 most useful Linux terminal commands and keyboard shortcuts that I think newbies should know:
1. ls
With this command, you can view the content of your current working directory. ls is often paired with options -l (to view a detailed list of files) and -a (to view the hidden files).
Use it like this:
$ ls -al
2. sudo
Allow users to run programs with the security privileges of another user (normally the superuser). By default, sudo will prompt for a user password but it may be configured to require the root password.
Use it like this:
$ sudo gedit
3. Ctrl-Alt-Esc
When an application hangs or fails to close, never worry. Pressing this keyboard shortcut and then clicking on the troubled application will kill or end its process.
4. find
This is probably the most efficient command to use when you are looking for some files. find searches through one or more directory trees of a filesystem, locating files based on some user-specified criteria. By default, find returns all files below the current working directory.
To recursively search for files that starts with letter j starting from the /home directory use:
$ find /home -name j*
5. apt-get
Since most Linux newbies are probably using Ubuntu, they should know how to use this command.
To install a package:
$ sudo apt-get install package-name
To remove:
$ sudo apt-get remove package-name
6. Ctrl-Alt-Backspace
This keyboard shortcut will kill the X server. Use this if X crashes and you can't exit it normally. This restarts the server and throws you back immediately to the graphical login screen.
7. mv, cp, rm
I know that it is a lot easier to move, copy, and delete files using the mouse. But, I find it important that newbies should also know how to do it from the command line just in case of emergency.
Use them like these:
move
$ mv oldfilename.txt newfilename.txt
copy
$ cp oldfilename.txt newfilename.txt
delete
$ rm oldfilename.txt
8. man
Most Linux commands and applications have manual pages, so man is really handy if you you want to learn more about a particular command or programs.
Use it like this:
man bash
With this command, you can view the content of your current working directory. ls is often paired with options -l (to view a detailed list of files) and -a (to view the hidden files).
Use it like this:
$ ls -al
2. sudo
Allow users to run programs with the security privileges of another user (normally the superuser). By default, sudo will prompt for a user password but it may be configured to require the root password.
Use it like this:
$ sudo gedit
3. Ctrl-Alt-Esc
When an application hangs or fails to close, never worry. Pressing this keyboard shortcut and then clicking on the troubled application will kill or end its process.
4. find
This is probably the most efficient command to use when you are looking for some files. find searches through one or more directory trees of a filesystem, locating files based on some user-specified criteria. By default, find returns all files below the current working directory.
To recursively search for files that starts with letter j starting from the /home directory use:
$ find /home -name j*
5. apt-get
Since most Linux newbies are probably using Ubuntu, they should know how to use this command.
To install a package:
$ sudo apt-get install package-name
To remove:
$ sudo apt-get remove package-name
6. Ctrl-Alt-Backspace
This keyboard shortcut will kill the X server. Use this if X crashes and you can't exit it normally. This restarts the server and throws you back immediately to the graphical login screen.
7. mv, cp, rm
I know that it is a lot easier to move, copy, and delete files using the mouse. But, I find it important that newbies should also know how to do it from the command line just in case of emergency.
Use them like these:
move
$ mv oldfilename.txt newfilename.txt
copy
$ cp oldfilename.txt newfilename.txt
delete
$ rm oldfilename.txt
8. man
Most Linux commands and applications have manual pages, so man is really handy if you you want to learn more about a particular command or programs.
Use it like this:
man bash
If your system freezes up, or if X gets into an infinite crash/restart loop, hold down Alt + SysRq and press each of the following letters:
ReplyDeleteR E I S U B
(or "arrrr! Everything is sucky! Un-Boot!")
The S will sync or write out buffered data to disk, U unmounts your drives, and B reboots. Not sure what R E and I do.
So `ls` only lists files in your home directory? Might want to add `cp` to the list of commands to open up more possibilities for its little friend `ls`.
ReplyDeleteSo `ls` only lists files in your home directory? Might want to add `cd` to the list of commands to open up more possibilities for its little friend `ls`.
ReplyDelete@Anonymous: Thanks for the correction. What I meant was "current working directory". I already edited it to clear things up.
ReplyDelete@Chris Lees: That I think is the ultimate exit strategy command in Linux. But, it's rarely used these days. I do hope Windows has a command like that because it crashes a lot ;-)
ReplyDeleteWhat? No apt-cache command? :) This is probably my most used command (mainly "apt-cache search") since I can find just about anything in the software repositories that I need. For example:
ReplyDeleteapt-cache search audio editor
will bring up a list of packages that match the term "audio editor". Nice list of commands, btw.
Maybe you could specify that the -r option must be used to delete folders with the rm command. I found it pretty confusing when I started with GNU/Linux.
ReplyDeleteAnother very useful thing is the tab completion when you don't know, or don't want to type, the full command.
the "man" command deserves to be at the top of the list imho
ReplyDeleteI guess 'locate' is missing out.
ReplyDelete