TranslateEnglishToLinux

You are sitting at a bash command-line window, and you know what you want to do,
but you don't know the Linux command to get it done.
Search on this page to find the simple English expression of what you want to do.
On the right will be the same expression in Linux.
Copy and paste the Linux expression into your window.
Replace Foo and Bar. (Leave the quotation marks.)
Press Enter.

(If you think this page is a good idea, please support it
by voting for it as Solution #11 on http://brainstorm.ubuntu.com/idea/28433/ )


(Some translations are under development.)

What kind of command-line window is this?

ps -p $$ -o comm=

What kind of command-line window is this?

echo $0 $@


Tell me about the working folder.

What is it?

pwd

Do things in the working folder.

Go up a folder.

cd ..

Go to sub folder Foo.

cd "Foo"

Go to the root folder.

cd /

Create a file named Foo.

echo "" > "Foo"

Create a new folder named Foo.

mkdir "Foo"

Delete a file named Foo.

rm -iv "Foo"

Delete a folder named Foo.

rm -irv "Foo"


Tell me about file Foo.

Where is it? (on the whole file system)

sudo find / -name "Foo" -print

Where is it? (in this folder and sub folder)

sudo find ./ -name "Foo" -print

Where is it? (in my files)

find $HOME -name "Foo" -print

Where is it? (in my files)

find ~/ -name "Foo" -print

What kind of file is it?

file -hkpz "Foo"

How big is it?

sudo du -hlLs "Foo"

How big is it?

stat -c'File "%n" contains %s bytes.' "Foo"

When was its contents last read?

stat -c'File "%n" was last read at: %x' "Foo"

What was its contents last written?

stat -c'File "%n" was last written at: %y' "Foo"

When was its contents or attributes last written?

stat -c'File "%n" was last changed at: %z' "Foo"

What are its attributes?

stat "Foo"

What are its attributes?

lsattr -v "Foo"

Can I read it?

if [ `find ./ -maxdepth 1 -readable -name "Foo"` ]; then echo 'yes'; else echo 'no'; fi

Can I write it?

if [ `find ./ -maxdepth 1 -writable -name "Foo"` ]; then echo 'yes'; else echo 'no'; fi

Can I run it?

if [ `find ./ -maxdepth 1 -executable -name "Foo"` ]; then echo 'yes'; else echo 'no'; fi

Who is the owner?

stat -c'File "%n" is owned by %U.' "Foo"

Can the owner read it?

if [[ `stat -c'%A' "Foo"` =~ ^.r........$ ]]; then echo 'yes'; else echo 'no'; fi

Can the owner write it?

if [[ `stat -c'%A' "Foo"` =~ ^..w.......$ ]]; then echo 'yes'; else echo 'no'; fi

Can the owner run it?

if [[ `stat -c'%A' "Foo"` =~ ^...x......$ ]]; then echo 'yes'; else echo 'no'; fi

What group is it in?

stat -c'File "%n" has %G for its group.' "Foo"

Can this group read it?

if [[ `stat -c'%A' "Foo"` =~ ^....r.....$ ]]; then echo 'yes'; else echo 'no'; fi

Can this group write it?

if [[ `stat -c'%A' "Foo"` =~ ^.....w....$ ]]; then echo 'yes'; else echo 'no'; fi

Can this group run it?

if [[ `stat -c'%A' "Foo"` =~ ^......x...$ ]]; then echo 'yes'; else echo 'no'; fi

Can anyone read it?

if [[ `stat -c'%A' "Foo"` =~ ^.......r..$ ]]; then echo 'yes'; else echo 'no'; fi

Can anyone write it?

if [[ `stat -c'%A' "Foo"` =~ ^........w.$ ]]; then echo 'yes'; else echo 'no'; fi

Can anyone run it?

if [[ `stat -c'%A' "Foo"` =~ ^.........x$ ]]; then echo 'yes'; else echo 'no'; fi

What package contains it?

dpkg -S "Foo"

What package contains it?

apt-file update; apt-file search "Foo"

What package created it?

What file system is it on?

Is it a symbolic link?

echo -n 'File "Foo" is '; if [ ! -h "Foo" ]; then echo -n 'not '; fi; echo 'a symbolic link.'

Is it a symbolic link?

if [ -h "Foo" ]; then echo 'yes'; else echo 'no'; fi

Foo names a file. What are the other names of this file?

sudo find -L / -samefile "Foo" -print

What are the other hard links to this file?

What are the other symbolic links to this file?

What processes are using this file?

fuser -auv "Foo"

Do things to file Foo.

Let anyone do anything with it.

chmod ugo+rwx "Foo"

Stop everyone from doing everything with it.

chmod ugo-rwx "Foo"

Let the owner read from it.

chmod u+r "Foo"

Let the owner write to it.

chmod u+w "Foo"

Let the owner run it.

chmod u+x "Foo"

Stop the owner from reading it.

chmod u-r "Foo"

Stop the owner from writing to it.

chmod u-w "Foo"

Stop the owner from running it.

chmod u-x "Foo"

Let group members read from it.

chmod g+r "Foo"

Let group members write to it.

chmod g+w "Foo"

Let group members run it.

chmod g+x "Foo"

Stop group members from reading it.

chmod g-r "Foo"

Stop group members from writing to it.

chmod g-w "Foo"

Stop group members from running it.

chmod g-x "Foo"

Let everyone read from it.

chmod o+r "Foo"

Let everyone write to it.

chmod o+w "Foo"

Let everyone run it.

chmod o+x "Foo"

Stop everyone from reading from it.

chmod o-r "Foo"

Stop everyone from writing to it.

chmod o-w "Foo"

Stop everyone from running it.

chmod o-x "Foo"

Edit it.

gedit "Foo"

Edit it.

nano "Foo"

Run it.

Foo

Run it.

./Foo

Create a copy of it named Bar.

cp "Foo" "Bar"

Delete it.

rm "Foo"

Create another file name for it, called Bar.

ln -iTv "Foo" "Bar"

Create a hard link to it, called Bar.

Create a symbolic link to it, called Bar.

Open it in an editor.

gedit "Foo"


Tell me about files whose name contains Foo.

What and where are they? (on the whole computer)

sudo find / -name "*Foo*" -print

What are their attributes?

ls -a "*Foo*"

What kind of file are they?

Which are symbolic links?

sudo find / -name "*Foo*" -type l -print

Which are executable?

Which are named more than once?

sudo find / -name "*Foo*" -links +n -print

What other file names refer to this them?

sudo find / -L -samefile "*Foo*" -print

What and where are all the files I can write to?

What and where are all the files I own?

Which and where are all the files bigger than 100 MBytes?

Do things to files whose name contains Foo.


Tell me about my file systems.

What are their names?

sudo find / -true -printf "%F\n" | sort -u

What are their names?

mount

What are their names?

cat /etc/fstab

Which file systems am I using?

cat /proc/filesystems

What kind are they?

Where are they mounted?

What is the root of this file system containing the file Foo?

tune2fs

How big is it?

How much storage space is available?

dumpe2fs

Do things to my file systems.

Create a file system.

mkfs

Check Foo. (use only on unmounted file systems!)

fsck -n

Create a folder to mount a file system.

fsck.ext4

Attach a file system at a folder.

mount

Attach Foo.

Unattach Foo


Tell me about files on this computer.

Where is executable code?

echo $PATH

Which are open?

lsof

Which are readable?

sudo find / -readable -print | sort -u

Which are writable?

sudo find / -writable -print | sort -u

Which are executable?

sudo find / -executable -print | sort -u

What types of files are there?

sudo find / -true -printf "%y\n%Y\n" | sort -u

Which are on file system type Bar?

sudo find / -fstype "Bar" -print | sort

Which are named more than once?

sudo find / -links +n -print

Which had their contents changed in the last 15 minutes?

sudo find / -cmin -16 -print

Which had their contents changed between 2 and 3 hours ago?

sudo find / -cmin +119 -cmin -181 -print

Which had their contents changed within the last 12 hours?

sudo find / -mount -cmin -720 -print | sort -u

Which had their contents changed within the last 12 hours?

sudo find / -cmin -720 -print | sort -u

Which had their contents changed sometime today?

Which had their contents changed sometime yesterday?

Which had their contents changed on February 17, 2011?

Which had their attributes, but not their contents,
changed in the last 30 minutes?

sudo find / -cmin -31 \! -mmin -31 -print

Which names do not name anything?

Which have an unknown user?

sudo find / -nouser -print

Which have an unknown group?

sudo find / -nogroup -print

Which are broken links?

Which are not really files, just names for operating system capabilities?

Which files have unusual characters in their name?

sudo find / -name "*[\$\#\@\^\&]*" -print

Do things to the files on this computer.


Tell me about the groups on this computer.

What are their names?

sudo find / -true -printf "%g\n" | sort -u

What files have Foo as their group?

sudo find / -group "Foo" -print | sort

Do things to the groups on this computer.


Tell me about this operating system.

What is its name?

uname -o

What is the name of the kernel?

uname -s

What is the kernel release?

uname -r

What is the kernel version?

uname -v

What are the processes doing?

top

Do things to this operating system.


Tell me about this hardware.

What kind of machine?

uname -m

What kind of processor?

uname -p

What kind of hardware platform?

uname -i

What are the disks?

Do things to this hardware.


Tell me about the disks.

What are the disks?

Where are the disks connected to the name space?

sudo find / -type b -print

What are their characteristics?

What are their operating parameters?

What is their status?

Where are the partitions?

df

Do things to the disks.

Test them all.

fdisk

Test disk "Foo".

fdisk

Create a partition.

fdisk


Tell me about this computer.

What is its name?

uname -n

What is its name?

sudo /bin/hostname

What is its name?

cat /etc/hostname

What is its name?

sysctl kernel.hostname

Who are the users?

cat /etc/passwd

What are the groups?

cat /etc/passwd

What are the groups?

sudo find / -printf '%g\n' | sort -u

What file systems are you using?

What version of Ubuntu are you running?

lsb_release -a

What processes are dead?

who -d

What hardware is connected to the USB ports?

lsusb

What hardware is connected to the PCI bus?

lspci

Do things to this computer.

Set it's name to Foo.

sudo /bin/hostname "Foo"

Set it's name to Foo. !For experts only!

sysctl kernel.hostname=Foo

Shut it down.


Tell me about this user account.

What is its name?

echo $USER

What are its environment variables?

printenv

What groups does it belong to?

Where are its directories?

sudo find / -type d -user $USER -print

What files does it own?

sudo find / -user $USER -print

What files in its home folder are owned by someone else?

sudo find $HOME \( ! -user "$USER" \) -printf '%u %h%f\n'

Do things to this user account.

Change my password.

passwd

Lock it.

Unlock it.


Tell me about the users on this computer.

What are their names?

sudo find / -true -printf "%u\n" | sort -u

What files does Foo own?

sudo find / -user "Foo" -print | sort

Do things to the users on this computer.


Tell me about my internet connections.

What is the start up configuration?

cat /etc/network/interfaces

What networks are currently operational?

ifconfig

What networks exist?

ifconfig -a

ip addr

wireshark

netstat

Do things to my internet connections.

Restart my internet connections.

sudo /etc/init.d/networking restart


Tell me about my wireless connections.

What is the start up configuration?

cat /etc/network/interfaces

What connections are available?

iwconfig

Do things to my wireless connections.

iwconfig

iw


Tell me about package Foo.

Is it installed?

dpkg -l 'Foo'

What version is it?

Is there a newer version?

What is its installation history?

apt-get changelog Foo

What files does it install?

What files are part of the installation package?

Do things to package Foo.

Install Foo.

sudo apt-get update; sudo apt-get install Foo

Install version Nnn of Foo.

sudo apt-get

Install the latest version of Foo.

sudo apt-get update; sudo apt-get upgrade Foo

Remove Foo.

sudo apt-get remove Foo


Tell me about packages whose name contains Foo.

Which are installed?

dpkg -l '*Foo*'

Write, to file Bar, the names of all installed packages.

dpkg -l >Bar

Do things to packages whose name contains Foo.


Tell me about packages.

Which are installed?

dpkg -l

Which installed packages are not
from the Ubuntu approved repositories?

Which were installed recently?

zcat -f /var/log/dpkg.log* | grep "\ install\ " | sort

Do things to packages.


Tell me about repositories.

What repositories am I using?

cat /etc/apt/sources.list

What repositories are available?

Do things to repositories.

Add a repository.

Remove a repository.


Tell me about Module Foo.

Is it loaded?

Do things to Module Foo.

Build it.

Load it.

sudo modprobe Foo

Unload it.


Tell me about modules whose name contains Foo.

What kernel modules are currently loaded?

lsmod

What kernel modules are on the computer?

sudo find / -name "*Foo*.ko" -print

Do things to modules whose name contains Foo.

Build them.


Tell me about modules.

What kernel modules are loaded at boot time?

cat /etc/modules

What kernel modules are currently loaded?

lsmod

What and where are the kernel modules?

sudo find / -name "*.ko" -print

What and where are the kernel module dependency files?

sudo find / -name "*module.dep*" -print

What version of the kernel is running?

uname -r

Do things to modules.

Build them all.


Odds and Ends.

Tell me about command Foo.

man "Foo"

Stop showing me this man page.

q

Read a system file.

gedit "Foo"

Read a system file.

cat "Foo"

Edit a system file.

gksudo gedit "Foo"

Repeat the last command.

<Up Arrow><Enter>

Show me some pictures?

Remove music sales.

sudo apt-get remove unity-scope-musicstores


Examples from man pages

Delete all files named "core" from the /tmp folder
and its sub directories.

find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f

What kind of files are in the current folder
and its sub directories?

find . -type f -exec file '{}' \;

List all setuid files in /root/suid.txt
and all large files in /root/big.txt.

find / \
\( -perm -4000 -fprintf /root/suid.txt %#m %u %p\n \) , \
\( -size +100M -fprintf /root/big.txt %-10s %p\n \)

Which of my files were changed in the last 24 hours?

find $HOME -mtime 0

Which sbin files are executable, but not readable?

find /sbin /usr/sbin -executable \! -readable -print

.

find . -perm 664

.

find . -perm -664

.

find . -perm /222

.

find . -perm /220

.

find . -perm /u+w,g+w

.

find . -perm /u=w,g=w

.

find . -perm -220

.

find . -perm -g+w,u+w

.

find . -perm -444 -perm /222 ! -perm /111

.

find . -perm -a+r -perm /a+w ! -perm /a+x

.

cd /source-dir
find . -name .snapshot -prune -o \( \! -name *~ -print0 \)|
cpio -pmd0 /dest-dir

.

find repo/ -exec test -d {}/.svn -o -d {}/.git -o -d {}/CVS ; \
-print -prune



These translations have a particular style. Please adhere to it.
The English is understood by those who are not experts at Linux commands or Linux internals.
Don't include explanations of the terms or commands.
Don't perpetuate the language misnomers and ambiguities of the man pages.
(For example, du is about files and df is about partitions, neither is about disks.)
Always follow links, unless the English explicitly mentions links.
Michael J. Daniel is the final arbor of all changes to this text.

TranslateEnglishToLinux (last edited 2011-12-26 14:47:57 by c-76-121-26-98)