Linux – Basic Commands

By | 11/05/2022

In this post, we will see some basic commands in Linux.


MANAGE DIRECTORIES

pwd: print name of current/working directory

ls: list directory contents

mkdir ‘directory name’: make directories

mkdir -p ‘directories names’: make parent directories as needed

rmdir: remove empty directory

rmdir -p ‘name of directories’: remove directory and its ancestors

rm -rf: remove a directory not empty


MANAGE FILES

file: determine file type

touch ‘file name’: change file timestamps. In case of file not existing, system will create an empty file

rm: remove files or directories

rm -i: prompt once before removing files

rm ‘*.file extension’: remove all files with the specified extension

rm ‘file1 file2 …’: remove files

cp: copy files and directories

mv: move (rename) file

head ‘file name’: output the first part of file (10 lines by default)

tail ‘file name’: output the last part of files (10 lines by default)

cat: concatenate files and print on the standard output

echo ‘text’: display a line of text


SYSTEM INFORMATION

uptime: tell how long the system has been running

free: display amount of free and used memory in the system

ps -e: report a snapshot of the current processes

df -h: report file system disk space usage

top: display Linux processes

htop: interactive process viewer


NETWORKING

ifconfig: configure a network interface

ping: send ICMP ECHO_REQUEST to network hosts


MISCELLANEOUS

sudo apt update: download package information from all configured sources

sudo apt upgrade: install the new packages

nano: editor

man: show the ‘Manual pages’ for Linux commands



Leave a Reply

Your email address will not be published.