LINUX Flashcards
pwd
pwd : It prints the current directory
cd
cd :it changes directory
cd /…
cd /.. : change directory to an absolute path under the computer directory which is the main directory
cd ./…
change directory in the current directory
ls or l
It lists the contents of the directory in alphabetical order
ls -l
lists the contents in the long way aka more details (the user , the groupe, the date , the time, permissions …), ls -r It lists the contents in revrsed alphabetical order
ls -r
It lists the contents in revrsed alphabetical order
ls -p
lists contents with file types
ls -s
it lists contents sorted by directories/files size
sudo (Super User DO):
It allows you to make changes to files and perform administrative tasks for the current command
sudo !!
It means run the previous command with sudo,
sudo su
it takes you to the root user so you can avoid typing sudo for every command if you want to use it for multiple tasks
su (Switch User )
It allows you to change the user su …
apt-get
It installs a package or a program that already exists or preinstalled in the unbuntu repositories
sudo apt-get install vscode :
it installs the vscode application we use sudo because installation need administrative permission
apt-cache …
:It allows us to search for the program
apt-cache search vscode*
it searchs anything with the word vscode in it
apt-cache policy vsscode
it search for the installed program and it gives you its version and repositories
dpkg
it installs , builds and removes debian packages
dpkg -i chrome-stable.deb
: is used to install the chrome package
dpkg -l
: is used to list the installed packages
dpkg –contents chrome-stable.deb
it lists contents of a package
cat
It is used to list the contents of a file
cat > filename
creates a new file
cat filename1 filename2>filename3
joins two files (1 and 2) and stores the output of them in a new file (3)
cat filename | tr a-z A-Z >output.txt
to convert a file to upper or lower case use
cp
It is used to copy files from the current directory to a different directory.
mv
It is used to move files, although it can also be used to rename files.
mkdir
it is used to create a new directory
rmdir
it is used to remove a directory
rm
it is used to remove directories and the contents with them , “to only remove the directory use rmdir … or rm -r …”
touch
it is used to create a blank new file
locate
t is used to tolocatea file, just like the search command in Windows. “What’s more, using the-iargument along with this command will make it case-insensitive”
find
Similar to thelocatecommand, usingfindalso searches for files and directories. The difference is, you use thefindcommand to locate files within a given directory.
grep
It lets you search through all the text in a given file.
“To illustrate,grep blue notepad.txtwill search for the word blue in the notepad file. Lines that contain the searched word will be displayed fully.”
df
It is used to get a report on the system’s disk space usage, shown in percentage and KBs. “If you want to see the report in megabytes, typedf -m.”
du
:Disk Usage) It is used to check how much space a file or a directory . However, the disk usage summary will show disk block numbers instead of the usual size format. If you want to see it in bytes, kilobytes, and megabytes, add the-hargument to the command line.