An Engineers Notebook

Linux Terminal Basics

Here are some of the basics for using Linux Terminal.

To run some of the following commands you need to have administrative access. Once Linux is installed, create a new user and log in as that, this will be the standard account. To run commands that require elevation precede the command with ‘sudo‘.
Before a standard user can do this they must first be added into the group ‘sudo‘. Once the user is created run:
usermod -aG wheel USERNAME
Basic Navigation
pwd – To see which folder you are in
dir – lists files and folders in the current directory
ls – lists files and folders in the current directory
cd    – Change Directory
example: cd Desktop/
cd .. – move up one level
mv – Move a file or it can be used to rename a file too.
Move example: mv sampletext.txt Desktop/
Rename example: mv sampletext.txt justsampletext.txt
cp – justsampletext.txt /root
rm – justsampletext.txt  – Deletes the text file.
Help functions
We can get help on commands and apps. Here we get help on VIM text editor.
vim –help
Or we could use a ‘Man page‘ which is a more verbose help function.
man vim
Network configuration

ifconfig – Interface configuration
Change IP address
First run an ifconfig and identify the interface you need to configure. Ethernet interfaces are named ‘eth0’ , ‘eth1’ and so on. 
ifconfig eth0

Any changes wont take effect untill the machine is rebooted or the NIC is disabled and re-enabled.
ifconfig eth0 down
ifconfig eth0 up
All of this can also be done in the GUI.
GREP is used to get an end result. In the example below we can use grep to filter the results of the ls command to anything with ‘NTFS’ in it in the sbin folder.
ls | grep ntfs


The kill command can be used to terminate processes. I have started VIM and opened another Terminal.
ps -A – Shows list of all running processes. 
We could pipe this into grep to narrow down our search.
ps -A | grep vim

ps -A | grep vim

Now we have the process ID we can terminate it. The “-9” is a semi-graceful way to terminate the process.
kill – 9 1786

If kill -9 does now work, -15 is the most efficient kill value.

Installing applications

If we know the name of an application we can simply install it from the terminal; here we install an text editor called ‘kate’.
apt-get install kate

Leave a Reply

Your email address will not be published.