Linux Ubuntu Basic Commands

Ubuntu is very famous for its CLI ("Command Line Interface"). CLI itself is an interface that does not provide graphics, whether in the form of images, windows or animations that can spoil the user, but only in the form of text that must be typed by the user.
So, if the user wants to perform operations in the operating system, for example "copy, rename, cut, delete, etc." then the user must type the commands in the form of text manually and not by clicking like on the GUI interface (Graphic User Interface) .

The following are some commands that can be used on the Ubuntu operating system in CLI mode, both Desktop and Server, which are also many to be used on other distributions. In this example I use Ubuntu Desktop 10.10.

Login
Used to log in as another user, but must be root first to be able to run this command.

sudo su
Used to login as root / highest user
Syntax: sudo su.

pwd
Used to show in the directory where we are now.
Syntax: pwd

cd
Used to move directories.
Syntax: cd address_directory
Example: cd /var/www

cp
Used to copy files.
Syntax: cp /directory/ file you want to copy/destination directory
Example: cp /etc/file1.txt/var/www

ls
Used to view the contents of a directory.
Syntax: ls

mv
Used to move, cut or rename files.
Syntax:
mv /directory/file you want to cut/destination directory (cut)
mv /directory/file_you want_to_rename/new_name_file (rename)
Example:
mv /etc/file1.txt/var/www
mv /etc/file1.txt file2.txt

mkdir
Used to create a new folder.
Syntax: mkdir folder_name
Example: mkdir folder1

rmdir
Used to delete a folder.
Syntax: rmdir folder_name
Example: rmdir folder1

touch
Used to create new files.
Syntax: touch filename
Example: touch file1.txt

more
Used to display the contents of a file
Syntax: more file_name
Example: more file1.txt

rm
Used to delete files.
Syntax: rm file_name
Example: rm file1.txt

echo
Used to write a word or sentence to a file.
Syntax: echo "message body" filename
Example: echo "Hi this is an example message" >> file1.txt

adduser
Used to add a new user.
Syntax: adduser username
Example: adduser johndoe

addgroup
Used to add a new group.
Syntax: addgroup group_name
Example: addgroup group1

lsusb
Used to view USB devices that are connected to a computer.
Syntax: lsusb

lspci
Used to view PCI devices that are currently connected to the computer.
Syntax: lspci

lshw
Used to see computer hardware.
Syntax: lshw

dmseg
Used to see the hardware being active
Syntax: dmseg

top
Used to see the processes that are running, such as Task Manager in Windows.
Syntax: top

cpuinfo
Used to see computer specifications.
Syntax: more /proc/cpuinfo

meminfo
Used to see RAM status
Syntax: more /proc/meminfo

clear
Used to clean the screen
Syntax: clear

halt
Used to turn off the computer, but must be as root.
Syntax: halt

reboot
Used to restart the computer, but must be as root.
Syntax: reboot

exit
Used to exit the terminal.
Syntax: exit

wget
Used to download via the terminal
Syntax: wget link_download
Example: wget www.gefr.online/Insight_Calendar_1-1_Setup.exe

ifconfig
Used to view ethernet / network card configurations.
Syntax: ifconfig

apt-get
Used to get packages / software from the ubuntu repository online.
Sintax: apt-get package_name
Example: apt-get update (to do repository updates)
apt-get update wine (to get wine packages)

tar
Used to extract files.
Syntax: tar [parameter] filename
Example: tar -xzvf komodo-edit-5.2.4-4343-linux-libcpp6-x86.tar.gz

nautilus
Used to open the GUI view directly.
Syntax: nautilus
Example: sudo nautilus (using GUI mode with root status)

df-h
see the remaining hard drive capacity.
syntax: df -h

who
used to see our login name.
syntax: who

cat
used to open files.
syntax: paint
Example: cat test.txt

date
see date
syntax: date

cal
look at the calendar
syntax: cal

hostname
Displays the name of the computer.
syntax: hostname

free
See Free memory.
syntax: free

history
see what commands you've typed
Syntax: History

deluser
Removing users from the
syntax system: deluser [username]

uname -r = See the kernel used on the OS.

uname -a = Your kernel system information.

cat /proc/cpuinfo = View files in / proc directory which are not real files.

cat /proc/interrupts = See the interrupt address used.

cat /proc/version = Version of Linux and other information.

cat /proc/filesystems = View the filesystem used.

cat /etc/printcap = View printers that have been setup.

finger username = See user information, try running it; fingerroot

last = See previous users who have logged on the computer.
uptime = See the amount of time someone uses the computer, counting the last reboot.
ps (print status) = View the processes run by the user.
ps axu = See all processes that are run, even without terminal control, also displays the name of the user for each process.
top = View running processes, in the order in which the cpu is used.
apropos = To search for commands on operating systems that have the same function.
chmod = Changes the permissions of a directory / file.
wc = Count the number of words, the number of lines and the number of characters in a file.

man = Abbreviation of manual which is to display the manual page for all UNIX commands.
grep = Search for the contents of a file in any directory.
pwd = Displays the name of the directory where you are currently located.
ps = Used to monitor information about active processes in a UNIX system.
kill = Used to stop a process that is running.
bc = The bc command can be used as a calculator.
wall = Message sent by the super user. :w used to save the file or the same as (save).
:q is used to exit the bunch editor to save the file.
:wq is used to exit the editor while saving the file.
tail = Displays the last 10 lines of a file.
ls -l = See all complete files.
ls -a = Show all hidden files or directories.
ls -f = Display all files or directories without shorting.
grep root/etc/passwd = Search for words or sentences in the file.


Those are some commands that I remember at this time that can be used in many Linux distributions, although there are some that are only specific to Ubuntu. If there is something I can remember again, I will add. Hope it helps, and happy learning.

Post a Comment

0 Comments