100% found this document useful (1 vote)
277 views

Linux Commands: 1. PWD - Print Working Directory

The document provides an overview of common Linux commands and permissions. It lists commands for printing the working directory (pwd), changing directories (cd), listing files (ls), creating and updating files (touch), printing file contents (cat), printing and redirecting text (echo), making directories (mkdir), copying files and folders (cp), moving files (mv), removing files and folders (rm), listing processes (ps), terminating processes (kill), counting words in files (wc). It also describes Linux file permissions in terms of read, write and execute permissions for the owner, group and all users. Finally, it provides a brief overview of the VIM and NANO text editors.

Uploaded by

alzheimer
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
277 views

Linux Commands: 1. PWD - Print Working Directory

The document provides an overview of common Linux commands and permissions. It lists commands for printing the working directory (pwd), changing directories (cd), listing files (ls), creating and updating files (touch), printing file contents (cat), printing and redirecting text (echo), making directories (mkdir), copying files and folders (cp), moving files (mv), removing files and folders (rm), listing processes (ps), terminating processes (kill), counting words in files (wc). It also describes Linux file permissions in terms of read, write and execute permissions for the owner, group and all users. Finally, it provides a brief overview of the VIM and NANO text editors.

Uploaded by

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

Linux Commands

1. pwd - print working directory

2. cd [directory_name] – change directory


cd .. - change directory, going into the parent folder

3. ls – list files
ls -l – list with details
ls -lh – list with human readable size specifications

4. touch [file_name] – creates the file if it does not exist, otherwise, it updates its
timestamp
5. cat <file> - print the contents of the file

6. echo – print text


echo <text> – print text on the standard output
echo <text> > <file> – print text in file (replace its contents)
echo <text> >> <file> – append text in file

7. mkdir <dir_name> - make directory


8. cp [source] [destination] – copy the source to the destination (may it be file or
folder)
cp -r [source] [destination] – copies the source to the destination, recursively (for
folders)

9. mv [source] [destination] – move the source, to the destination

NOTE: if the destination is the same folder, then the file (or folder) is renamed.
10. rm [-r] [target] – removes the target file or folder. If the target is a folder,
than the -r parameter is needed (-r – recrusive)

11. ps – displays all processes of the current user


ps -e – displays all processes from the entire system
ps -eF – displays all processes from the entire system (specified by “-e”), with
details regarding CPU and memory consumption
12. kill <pid> - sends an interrupt signal (SIGINT ) to the process with id equal to
pid. Usually, the program starts its shutdown routine.
kill -9 <pid> - sends a kill signal (SIGKILL) to the specified process. Linux will
terminate the process.

13. wc – word count. Displays lines count, words count, and characters count.
Linux Permissions
The permissions are always presented in 3 groups:
- owner
- group
- all users

The permissions can be:


- read
- write
- execute

NOTE: near the permissions specifications, the directory flag is present.

The example has:


- 8 folders
- 2 files
The file i_can_be_run.sh has the following permissions:
-rwxr-xr-x meaning:

- – directory flag is not set

r – the owner can read the file


w – the owner can write the file
x – the owner can execute the file

r – members of the same group as the file, can read it


- – members of the same group as the file, cannot write it
x – members of the same group as the file, can execute it

r – all users can read


- – no other user besides the owner can write
x – all users can execute

File editors
VIM
i – edit
esc – select “menu”
:w [file_name] – save file
:q – quit
:wq – save and exit
:q! - the only way to quit if no change has been performed

NANO
All the commands are displayed at the footer of the application.
^ - means the combination of “Ctrl” and the followup letter

You might also like