Home
Browse
Create
Search
Log in
Sign up
Upgrade to remove ads
Only $2.99/month
Linux Commands for Everyday Use
STUDY
Flashcards
Learn
Write
Spell
Test
PLAY
Match
Gravity
Linux survival skills
Terms in this set (40)
ls
List the contents of the current folder or directory. Similar to dir command in Windows
ls
-l
List files in current folder in long format. You can see permissions and size of each file
pwd
Print (to screen) the name of the current folder you are in.
This is good to do before you do something drasting and irreversible like rm (remove or delete)
ps
List the ids of all running processes started by you (the currently logged user)
ps - ef
Like the ps command, but this one lists processes that have been started by users other than you.
It also list some other info about the processes e.g. uid,cpu usage, controlling tty etc
ls | grep
string expression
List files in the cur dir matching the string expression (regular expression match)
rm
filename
delete a file whose name matches filename
rm *
delete everything in the current working folder that is not a folder itself
CAREFUL. do a pwd first before doing this. Make sure you are in the right folder before doing something potentially disastrous
rm
expression
similar to rm *, but this one only deletes files that matches expression
example:
rm linux
This will delete the following files:
linux.pdf
linux.txt
somelinux.doc
linux-something.txt
linux
kill -9
PID
Forcibly stop a running process (given by the pid). Usually this command comes after the ps command.
usage
ps -ef | grep
process name
kill -9
process number
cat
filename
display the contents of a file. Output is to stdio (screen). This will not open the file for editing, simply for display
touch filename
Creates a file. If the filename specified is already existing, it will update the creation date attribute of the filename
top
Find out which processes is hogging the CPU and memory resources of the PC
whoami
Find out the username of the currently logged in user
sudo [command]
Borrow the elevated privilege of root, just for one command. You will not become root, but you will be allowed to execute the command as if you were root.
It will ask for password (your password, not root's) so that your action can be logged
su
someuser
login as
someuser
. You need to know his password though.
su
root
login as root. You need to know root's password
passwd
Change your own password
sudo passwd [username]
Change the the password of a particular user. You need sudo because changing a password requires root privilege
sudo passwd root
Change the password of root.
In Ubuntu, right after installation, you cannot login as root. So you may have to do to this if you want to be able to "su root"
df -h
Find out how much disk space is still left on your hard drive
uname -a
Find out the name of Operating system. If you want to find out whether you are using Debian, RedHat, OSX, BSD etc
clear
Clear the terminal screen
cd
folder name
change directory
. Go to the folder specified
cd
If you enter just cd (from anywhere you are) and then press ENTER, you will go to your HOME folder. It is functionally the same as
cd ~/
cd ~/
same as cd
mkdir
new folder
Create a directory on the current folder
usage:
pwd
mkdir notes
ls
lp -d "Printer Name" filename
Prints the contents of "filename" to a specified printer
echo
What you want to print
Print to stdio whatever you want to print
echo
$VARNAME
Print to screen the value of variable $VARNAME.
The $ sign in UNIX/Linux is used to denote a variable. So if you want to know what it contains, simply use echo
echo
$SHELL
Find out what kind of shell you are using, whether Bourne, BASH, KSH or CSH
chmod
Change the permissions of a file. A file has three sets of read-write-execute permissions
U G O
rwxrwxrwx
You can change this using chmod e.g.
chmod ugo-x hello . The permission of hello after this command will be
rw-rw-rw
To add permissions, use the + sign
chown
change the owner of a file
usage:
chown ted hello
Transfers the ownership of hello to a user named ted
cp
Copy a file
usage
cp hello.txt hello2.txt
Copies the file hello.txt to a new file named hello2.txt
cat hello.txt > hello2.txt
> is called a redirection operator. It directs the output of the command to a file. In this case, the contents of hello.txt was read, but instead of sending it to the screen, it was redirected to another file named hello2.txt
This is has the same effect as "cp hello.txt hello2.txt"
ln -s
Soft linking [finish this]
which
name of executable file
Find out exactly where an executable file.
usage:
which java
which mysql
whereis
see 'which'
ssh
Login to a remote server securely
usage;
ssh myname@somehost.com
After that, it's like working on a local terminal, only, remotely
ssh
myname@somehost -p 222
see
ssh
THe
-p
option allows you to specify a port number other than the default which is
22
THIS SET IS OFTEN IN FOLDERS WITH...
Basic Linux Commands
40 terms
Linux+ LX0-101 Chapter 1: Exploring Linux Command-…
62 terms
Linux Command-Line Cheat Sheet
77 terms
Linux+ Final Exam Study Guide
70 terms
YOU MIGHT ALSO LIKE...
CIS 121
63 terms
linux study
172 terms
LX0-101 Practice Exam 3
60 terms
git
93 terms
OTHER SETS BY THIS CREATOR
Declarative Event Handling
4 terms
Android Basic Concepts
2 terms
HTML5 elements
8 terms
Complex Types
3 terms