0% found this document useful (0 votes)
23 views

Basic Linux Commands: Working With Files

This document provides a summary of basic Linux commands in 3 categories: commands for working with files, directories, and files/directories. It lists commands for viewing username and system information, manipulating files like copying, moving, deleting, and viewing files, creating and removing directories, and hiding/unhiding files.

Uploaded by

vaishali
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Basic Linux Commands: Working With Files

This document provides a summary of basic Linux commands in 3 categories: commands for working with files, directories, and files/directories. It lists commands for viewing username and system information, manipulating files like copying, moving, deleting, and viewing files, creating and removing directories, and hiding/unhiding files.

Uploaded by

vaishali
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Basic Linux Commands

1)logname: it shows current username

2)pwd: Present working directory which means current folder in linux

3)date: it display system date and time

4)clear: to clear the screen

5)cal: current month calendar we can call month and year along with cal
command  ex: cal 5 1984  which displays may month 1984

6)uname: os name

7)uname -r: displays kernal version

8)hostname: displays server name

9)hostname -i: display server ip address

10)who: it shows list  of connect user in that server

11)who am i: current logged user info

12)su: switch username from one user into another user ex:su - username

13)exit: logout from current user logged in

14)man command name: help of the given command

WORKING WITH FILES:

1)cat:  which is use to create a new file or open to  view existing files

2)cat>>filename: appending data to these file

3)$touch filename: which  create an empty file with zero kb

FILE DELETION:

 1)rm: to delete the file

 2)rm -rf: delete the files forcibly

 3)rm -i: delete the file with user conformation

 4)rm file1 file2: deleting multiple files

WORKING WITH DIRECTORIES:


1)mkdir: to create a new directory (Directory is  nothing  but a drive or
folders) in linux

2)cddirname: to change a directory

3)cd .. : to moves from  current directory into previous directory

4)cd: to come out entire directory

5)cd /: it changes the root directory

REMOVING DIRECTORIES:

1)rmdir: to removing directory it must be empty

2)rm -r direcname: it deletes recursively to entire structure

3)rm -ridirecname: it deletes recursively to entire structure with user


conformation.

4)rm -rfdirecname: it deletes recursively to entire structure with forcibly

COPY COMMANDS

1)cpsourcefiletargetfile: copying file from existing location into  new location

MOVING COMMANDS

1)mv old file newlocation: using these command we can move a file from
one folder into  another  folder or we can rename file also

VIEWING FILE COMMANDS

1)ls : it's listing files which are in that directory with  ascending order

2)ls -a: listed all files including  hidden files also

3)ls -l: listed all files in long list  format i.e 9 field

4)ls -t: listed all files based on date and time of creation

5)ls -r: listed all files on descending order or sin reverse

6)ls -R: listed all files recursively

CREATING HIDDEN FILES

1)cat>.filename

2)mv filename .filename

3)mkdir .dirname
UNHIDE FILES

1)mv .empemp

2)mv .dirnamedirname

You might also like