How to use the Terminal? (Fedora)

I've just gotten my LiveUSB and all, everything works fine. But I'd like to learn how to use the terminal. Firstly, I look up some guides and shit, it says "to remove files use the command "sudo yum remove your_file"" but when I do it goes on about that there's no package with that name... Any tips?

sudo yum remove is how you remove a program or package. To remove a file you type rm your_file

1 Like

tried that as well but it said the same.

Have you made sure you're in the correct directory?

1 Like

What exactly are you trying to do? Can you paste in the command you're trying to run and explain the desired results?

that is probably why, all I did was type the command and didn't move to any directory.

Okay, you can do that using the cd command. The default directory should be /home/your_username/.
Also if you want to learn more I'd recommend checking out some tutorials. I think the TheNewBostons Linux video series is a pretty good way to start, but I'm sure there are other options.

2 Likes

I'll check them out, but I can't seem to get to the directory i want to, I want to get to "Documents", the path is /home/documents/, but when I use that with cd it says that there is no such directory.

Are you sure it's not /home/YOUR_USERNAME/Documents ? Try doing cd ~/Documents/ or cd ~/documents/ .
~ is short for /home/YOUR_USERNAME.

1 Like

I use the command "cd /Home/MY_USERNAME/Documents/" and I get "No such file or directory"

The H should be lowercase, so that's cd /home/YOUR_USERNAME/Documents/ or cd ~/Documents/

1 Like

Now it worked, really picky about lower and uppercases.

Yep. Also a quick tip: You can use tab to auto-complete, so if you press tab and it doesn't auto-complete for you you've probably mistyped something.
Also if you double-click tab it should bring up a list of all of the options.

1 Like

Oh, that's nice, it's like cisco's CLI :D

1 Like

List of useful commands with a short description of what they do. You might recognize most of these since they are mostly POSIX compatible.

cat - prints out the contents of a file. useful for log files
cd - change active directory
pwd - list what directory you are in
ls - lists what files are in a directory
chmod - change permissions on a file
chown - change who owns a file
sudo - always a user to run programs as root
man - manual files for a program
echo - write text into a file and/or display text when scripting
dnf - install programs from fedoras repo. alt to apt-get on *Buntu based distros
whoami - can be used to find out what user you are
vi, vim, nano, etc - used to edit files
cp - copys a file
mv - moves a file
rm - removes a file

there is many more but these are most of what you will use in everyday use of the terminal


Examples of programs
man

'man foo' gives you the manual page for the program foo
'man -k foo' lists manual pages with foo in it

sudo BE VERY CAREFUL WITH THIS COMMAND!!!

'sudo foo' runs foo as root
'sudo su' runs su as root which will log you in as root without the password
'sudo -l' same as above but different way todo it.

cd

'cd ~/' cd to your home directory
'cd ..' cd up one directory
'cd .' cd to the current directory mostly useless
'cd /' cd to the root directory

ls

'ls -l' will list files along with all of their permissions
"ls -a' will show all files in a directory including hidden files and folders starting with a period
'ls -la' will do both things of the above commands

cat

'cat foo.txt' will print out the contents of foo.txt

pwd

'pwd' prints out what directory you are in

chmod

file permissions are done via octal bits. Octal bits are 1=exec 2=write 4=read. add them together to get what permission you want. 1+4=5 so read + exec.
permission bits are 'owner:group:world'. so 764 mean owner has read, write, and exec bits. group has read and write bits. world can only read the file.

'chmod 764 foo.txt' set foo.txt to 764
'chmod +x foo.txt' add exec bit to foo.txt
'chmod -w foo.txt' gets rid of the write bit on foo.txt

chown

'chown Dje4321:foo foo.txt' changes foo.txt so that Dje4321 is the owner and foo is the group

echo

'echo foo' prints out foo on the screen
'echo foo > foo.txt' writes foo to a newline on foo.txt. if foo.txt is nonexistent then it is created

dnf

in most cases dnf will need to be run as root to perform actions like installing a package. you can look but not touch
'sudo dnf install foo' install the program foo
'sudo dnf install foo.i686' installs the 32bit version of foo
'sudo dnf search foo" searches for the program foo
'sudo dnf remove foo' uninstalls foo
'sudo dnf update' updates the system
'sudo dnf update foo' update package foo

cp

'cp foo.txt ~/foo.txt' copies foo.txt to your home folder
'cp -r foo ~/Desktop' copies folder foo to your desktop. -r means the cp will be recursive when coping

mv

'rm foo.txt ~/foo.txt' moves foo.txt to your home folder
'mv -r foo ~/Desktop' moves folder foo to your desktop. -r means the mv will be recursive when coping.
'mv foo newfoo' renames file foo to newfoo

rm

'rm foo.txt' removes file foo.txt
'rm -r ~/Desktop/foo' removes folder foo from your desktop.

whoami

whoami - tells you what user you are

vi, vim, nano, etc

vi foo.txt
nano foo.txt
opens foo.txt in a terminal based text editor

I hope this helps you get started with the basics of using the terminal. I didnt go into stuff like piping input and output around because that might be a little to much atm.

Good luck linuxing

6 Likes

nerd

2 Likes

thanks you very much! At the moment I have no goal of why I'm learning to use Linux but I'll probably find something to do with it, because I mainly game so I've been on Windows for my whole life.

1 Like

this is also a great resource for linux in general
https://www.nostarch.com/tlcl
(get at a discount)

2 Likes

There is a Humble Bundle book sale on with a whole lot of resources on learning bash (the shell that Fedora uses to interpret commands) and command-line utilities.

3 Likes

--help is your friend

When using commands you usually append flags to the end lke "ls -l" to get a list of files with permissions or "chmod -R 740 yourfilename" to set permissions on all files within a directory.

To get informaiton about flags and usage use --help

chmod --help
ls --help

2 Likes