The beauty of linux is that it has a console that allows you to do whatever you want with the OS. Today we are going to do a brief introduction to some of the basic commands for the most versions of the linux console.
Before we start to talk about file system commands and how to work with files on the command line we need to take a look at some of the most basic commands:
General Commands
Command | Description |
---|---|
whoami | display the name of the user logged in |
sudo | execute a command as super user |
su | switch user to root |
man | manual pages for any command |
logout | exits the user |
clear | clears the console to blank |
password | change the password for the current user |
Now is time to talk see some of the commands for the file system
File System Commands
Command | Description |
---|---|
ls | List current directory and items |
ls -l | List current directory and items, including permissions |
cd | Change to a different directory |
Okay, this is good, we have seen commands that will allows us to browse through the file system, but how do we work with the files? how to create them, edit them and more? Here is a list for those commands:
Working with Files
Command | Description |
---|---|
echo | Displays on screen a text string |
nano | Text editor(CTRL+X to exit and save) |
less | Display file contents with fixed length |
cp | Copy |
mv | Move or rename file or directory |
rm -r | Remove or delete, -r removes content firs (recursive) |
mkdir | Make a directory |
cat | Displays the file output to the screen |
touch | Create file |
We can also control the output of the commands, here are some of the commands for it:
Control Command Output
Symbol | Description |
---|---|
| | pipe, directs command output to next command |
grep | Search for matching strings |
> | Send output to file |
>> | Append output to file |
< | Send input to a program |
We have seen 4 different groups of commands that will help us to get started with the console, this are some basic commands, you can always get more documentation on the official ubuntu wiki